upgrade chart.js lib and fix bargraph. fixes #511

This commit is contained in:
msquare 2018-12-09 13:07:19 +01:00
parent 93b819025c
commit 412be8e188
2 changed files with 10 additions and 7 deletions

View File

@ -25,7 +25,7 @@ function bargraph($dom_id, $key, $row_names, $colors, $data)
} }
$datasets[] = [ $datasets[] = [
'label' => $name, 'label' => $name,
'fillColor' => $colors[$row_key], 'backgroundColor' => $colors[$row_key],
'data' => $values 'data' => $values
]; ];
} }
@ -34,9 +34,12 @@ function bargraph($dom_id, $key, $row_names, $colors, $data)
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
var ctx = $(\'#' . $dom_id . '\').get(0).getContext(\'2d\'); var ctx = $(\'#' . $dom_id . '\').get(0).getContext(\'2d\');
var chart = new Chart(ctx).Bar(' . json_encode([ var chart = new Chart(ctx, ' . json_encode([
'type' => 'bar',
'data' => [
'labels' => $labels, 'labels' => $labels,
'datasets' => $datasets 'datasets' => $datasets
]
]) . '); ]) . ');
}); });
</script>'; </script>';

View File

@ -3,8 +3,8 @@
"version": "1.1.0", "version": "1.1.0",
"main": "index.js", "main": "index.js",
"repository": "https://github.com/engelsystem/engelsystem.git", "repository": "https://github.com/engelsystem/engelsystem.git",
"author": "marudor <marudor@marudor.de>", "author": "https://github.com/engelsystem/engelsystem/contributors",
"license": "MIT", "license": "GPL-2.0-only",
"scripts": { "scripts": {
"build": "npm run -s build:clean && NODE_ENV=production run-p build:assets build:webpack", "build": "npm run -s build:clean && NODE_ENV=production run-p build:assets build:webpack",
"build:clean": "rimraf public/assets", "build:clean": "rimraf public/assets",
@ -15,7 +15,7 @@
"dependencies": { "dependencies": {
"bootstrap": "^3", "bootstrap": "^3",
"eonasdan-bootstrap-datetimepicker": "^4.17.47", "eonasdan-bootstrap-datetimepicker": "^4.17.47",
"chart.js": "^1", "chart.js": "^2",
"jquery": "^3.3.1", "jquery": "^3.3.1",
"jquery-ui": "^1.11.2", "jquery-ui": "^1.11.2",
"moment": "^2.8.2", "moment": "^2.8.2",