-
Notifications
You must be signed in to change notification settings - Fork 0
/
Table.php
executable file
·95 lines (88 loc) · 2.34 KB
/
Table.php
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE HTML>
<html>
<head>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>
var dataJSON={};
function addData(data){
//console.log(data.mA);
dataJSON=data;
drawGraph();
}
function drawGraph(){
//$.getJSON("migratedata.json", addData);
console.log(dataJSON);
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title:{
text: "Inventory Transfer Graphs",
fontFamily: "arial black",
fontColor: "#695A42"
},
axisX: {
interval: 1,
intervalType: "year"
},
axisY:{
valueFormatString:"#",
gridColor: "#B6B1A8",
tickColor: "#B6B1A8"
},
toolTip: {
shared: true,
content: toolTipContent
},
data: [{
type: "stackedColumn",
showInLegend: true,
color: "#696661",
name: "Quantity",
dataPoints: [
{ y: parseInt(dataJSON.qInA), label:"Bangalore" },
{ y: parseInt(dataJSON.qInB), label:"Delhi" },
{ y: parseInt(dataJSON.qInC), label:"Pune" }
]
},
{
type: "stackedColumn",
showInLegend: true,
name: "Threshhold",
color: "#EDCA93",
dataPoints: [
{ y: parseInt(dataJSON.mA), label:"Bangelore" },
{ y: parseInt(dataJSON.mB), label:"Delhi" },
{ y: parseInt(dataJSON.mC), label:"Pune" }
]
}]
});
chart.render();
function toolTipContent(e) {
var str = "";
var total = 0;
var str2, str3;
for (var i = 0; i < e.entries.length; i++){
var str1 = "<span style= \"color:"+e.entries[i].dataSeries.color + "\"> "+e.entries[i].dataSeries.name+"</span>: <strong>"+e.entries[i].dataPoint.y+"</strong><br/>";
total = e.entries[i].dataPoint.y + total;
str = str.concat(str1);
}
//str2 = "<span style = \"color:DodgerBlue;\"><strong>"+(e.entries[0].dataPoint.x).getFullYear()+"</strong></span><br/>";
//total = Math.round(total * 100) / 100;
//str3 = "<span style = \"color:Tomato\">Total:</span><strong> $"+total+"</strong>bn<br/>";
//return (str2.concat(str)).concat(str3);
return str;
}
}
window.onload = function () {
$.getJSON("migratedata.json", addData);
//drawGraph();
}
</script>
</head>
<body>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
</body>
</html>