-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchart-1.php
More file actions
56 lines (49 loc) · 1.35 KB
/
chart-1.php
File metadata and controls
56 lines (49 loc) · 1.35 KB
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
<?php
$dataPoints = array(
array("x"=> 10, "y"=> 41),
array("x"=> 20, "y"=> 35, "indexLabel"=> "Lowest"),
array("x"=> 30, "y"=> 50),
array("x"=> 40, "y"=> 45),
array("x"=> 50, "y"=> 52),
array("x"=> 60, "y"=> 68),
array("x"=> 70, "y"=> 38),
array("x"=> 80, "y"=> 71, "indexLabel"=> "Highest"),
array("x"=> 90, "y"=> 52),
array("x"=> 100, "y"=> 60),
array("x"=> 110, "y"=> 36),
array("x"=> 120, "y"=> 49),
array("x"=> 130, "y"=> 41)
);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>PHP Charts & Graphs with Index / Data Label</title>
</head>
<body>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script>
window.onload = function() {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
exportEnabled: true,
theme: "light1",
title: {
text: "Simple Column Chart with Index Labels"
},
axisY: {
includeZero: true
},
data: [{
type: "column",
indexLabelFontColor: "#5A5757",
indexLabelPlacement: "outside",
dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
}]
});
chart.render();
}
</script>
<script src="js/canvasjs.min.js"></script>
</body>
</html>