Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ H5P.Chart.BarChart = (function () {
if (d.fontColor !== undefined) {
return '#' + d.fontColor;
}
// Set default color as black
return '#000000';
});

Expand All @@ -82,7 +83,7 @@ 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);
Expand Down Expand Up @@ -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;
});
};
}
Expand Down
1 change: 1 addition & 0 deletions chart.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.h5p-chart svg {
display: block;
margin: 0 auto;
padding-top: 20px;
}
.h5p-chart-chart {
font-size: 0.75em;
Expand Down
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Create different charts",
"majorVersion": 1,
"minorVersion": 0,
"patchVersion": 1,
"patchVersion": 2,
"runnable": 1,
"author": "Joubel AS",
"license": "MIT",
Expand Down Expand Up @@ -34,4 +34,4 @@
"minorVersion": 0
}
]
}
}
4 changes: 2 additions & 2 deletions semantics.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
"type": "text",
"widget": "colorSelector",
"label": "Color",
"default": "000",
"default": "red",
"optional": true
},
{
"name": "fontColor",
"type": "text",
"widget": "colorSelector",
"label": "Font Color",
"default": "fff",
"default": "000",
"optional": true
}
]
Expand Down