From be72813c9e13d528013af7911a10ec699596c18e Mon Sep 17 00:00:00 2001 From: Timothy Lim Date: Mon, 30 May 2016 12:49:45 +0200 Subject: [PATCH 1/3] Fix issue with hidden labels --- bar.js | 9 +++++---- chart.css | 1 + library.json | 4 ++-- semantics.json | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bar.js b/bar.js index 008cb455..219375fc 100644 --- a/bar.js +++ b/bar.js @@ -72,7 +72,8 @@ H5P.Chart.BarChart = (function () { if (d.fontColor !== undefined) { return '#' + d.fontColor; } - return '#000000'; + // Set default color as black + return '#00000'; }); /** @@ -82,13 +83,13 @@ H5P.Chart.BarChart = (function () { // Always scale to available space var style = window.getComputedStyle($wrapper[0]); var width = parseFloat(style.width); - var h = parseFloat(style.height); + var h = parseFloat(style.height)-20; var fontSize = parseFloat(style.fontSize); var lineHeight = (1.25 * fontSize); var tickSize = (fontSize * 0.125); var height = h - tickSize - lineHeight; // Add space for labels below - // Update SVG size + // Update size svg.attr("width", width) .attr("height", h); @@ -120,7 +121,7 @@ H5P.Chart.BarChart = (function () { return xScale(i) + xScale.rangeBand() / 2; }) .attr("y", function(d) { - return height - yScale(d.value) + lineHeight; + return height - yScale(d.value) + lineHeight - 20; }); }; } diff --git a/chart.css b/chart.css index ec6fafc1..f0c04d12 100644 --- a/chart.css +++ b/chart.css @@ -1,6 +1,7 @@ .h5p-chart svg { display: block; margin: 0 auto; + padding-top: 20px; } .h5p-chart-chart { font-size: 0.75em; diff --git a/library.json b/library.json index 4829d03f..713b0c60 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "description": "Create different charts", "majorVersion": 1, "minorVersion": 0, - "patchVersion": 1, + "patchVersion": 2, "runnable": 1, "author": "Joubel AS", "license": "MIT", @@ -34,4 +34,4 @@ "minorVersion": 0 } ] -} \ No newline at end of file +} diff --git a/semantics.json b/semantics.json index fdcac218..58261a8b 100644 --- a/semantics.json +++ b/semantics.json @@ -52,7 +52,7 @@ "type": "text", "widget": "colorSelector", "label": "Font Color", - "default": "fff", + "default": "000", "optional": true } ] From 9f90ca9a39d1fd6813b7b456d955476551008cd6 Mon Sep 17 00:00:00 2001 From: Timothy Lim Date: Mon, 30 May 2016 12:53:31 +0200 Subject: [PATCH 2/3] Update bar.js --- bar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bar.js b/bar.js index 219375fc..83bed21f 100644 --- a/bar.js +++ b/bar.js @@ -73,7 +73,7 @@ H5P.Chart.BarChart = (function () { return '#' + d.fontColor; } // Set default color as black - return '#00000'; + return '#000000'; }); /** @@ -89,7 +89,7 @@ H5P.Chart.BarChart = (function () { var tickSize = (fontSize * 0.125); var height = h - tickSize - lineHeight; // Add space for labels below - // Update size + // Update SVG size svg.attr("width", width) .attr("height", h); From d411deb539692264d10d28e71b5f6c924a041fc3 Mon Sep 17 00:00:00 2001 From: Timothy Lim Date: Mon, 30 May 2016 13:43:31 +0200 Subject: [PATCH 3/3] Update semantics.json --- semantics.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/semantics.json b/semantics.json index 58261a8b..a1ccf056 100644 --- a/semantics.json +++ b/semantics.json @@ -44,7 +44,7 @@ "type": "text", "widget": "colorSelector", "label": "Color", - "default": "000", + "default": "red", "optional": true }, {