blob: ee39c68c1d4124464d1e023dbdcc9cedde18c5f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
Kanboard.Budget = (function() {
jQuery(document).ready(function() {
if (Kanboard.Exists("budget-chart")) {
var labels =$("#chart").data("labels");
var serie = $("#chart").data("serie");
var types = ["in", "out", "left"];
var data = [];
for (var i = 0; i < serie.length; i++) {
for (var j = 0; j < types.length; j++) {
var row = {};
row[labels["date"]] = serie[i]["date"];
row[labels["value"]] = serie[i][types[j]];
row[labels["type"]] = labels[types[j]];
data.push(row);
}
}
var svg = dimple.newSvg("#chart", 750, 600);
var myChart = new dimple.chart(svg, data);
var x = myChart.addCategoryAxis("x", [labels["date"], labels["type"]]);
x.addOrderRule(labels["date"]);
myChart.addMeasureAxis("y", labels["value"]);
myChart.addSeries(labels["type"], dimple.plot.bar);
myChart.addLegend(65, 10, 510, 20, "right");
myChart.draw();
}
});
})();
|