Skip to content

Commit 06ffecd

Browse files
committed
canvas demo - TBD
1 parent da434c4 commit 06ffecd

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

demo/canvasJS.html

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>CanvasJS grid demo</title>
5+
6+
<link rel="stylesheet" href="demo.css"/>
7+
<script src="../dist/gridstack-jq.js"></script>
8+
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
9+
10+
<style type="text/css">
11+
body { margin: 8px 0; } /* make grid take entire vw so we have correct square cells */
12+
</style>
13+
</head>
14+
<body>
15+
<div>
16+
<h1>CanvasJS grid demo</h1>
17+
<br/>
18+
<div class="grid-stack">
19+
</div>
20+
</div>
21+
22+
<script type="text/javascript">
23+
let grid = GridStack.init({
24+
cellHeight: 'initial', // start square but will set to % of window width later
25+
animate: false, // show immediate (animate: true is nice for user dragging though)
26+
disableOneColumnMode: true, // will manually do 1 column
27+
float: true
28+
});
29+
30+
let items = [ // our initial 12 column layout loaded first so we can compare
31+
{x: 1, y: 1, w: 7, h:3 , content: '<div id="chartContainer" style="height: 370px; width: 100%;"></div>'},
32+
];
33+
grid.load(items);
34+
35+
var chart = new CanvasJS.Chart("chartContainer", {
36+
animationEnabled: true,
37+
title:{
38+
text: "Company Revenue by Year"
39+
},
40+
axisY: {
41+
title: "Revenue in USD",
42+
valueFormatString: "#0,,.",
43+
suffix: "mn",
44+
prefix: "$"
45+
},
46+
data: [{
47+
type: "splineArea",
48+
color: "rgba(54,158,173,.7)",
49+
markerSize: 5,
50+
xValueFormatString: "YYYY",
51+
yValueFormatString: "$#,##0.##",
52+
dataPoints: [
53+
{ x: new Date(2000, 0), y: 3289000 },
54+
{ x: new Date(2001, 0), y: 3830000 },
55+
{ x: new Date(2002, 0), y: 2009000 },
56+
{ x: new Date(2003, 0), y: 2840000 },
57+
{ x: new Date(2004, 0), y: 2396000 },
58+
{ x: new Date(2005, 0), y: 1613000 },
59+
{ x: new Date(2006, 0), y: 2821000 },
60+
{ x: new Date(2007, 0), y: 2000000 },
61+
{ x: new Date(2008, 0), y: 1397000 },
62+
{ x: new Date(2009, 0), y: 2506000 },
63+
{ x: new Date(2010, 0), y: 2798000 },
64+
{ x: new Date(2011, 0), y: 3386000 },
65+
{ x: new Date(2012, 0), y: 6704000},
66+
{ x: new Date(2013, 0), y: 6026000 },
67+
{ x: new Date(2014, 0), y: 2394000 },
68+
{ x: new Date(2015, 0), y: 1872000 },
69+
{ x: new Date(2016, 0), y: 2140000 }
70+
]
71+
}]
72+
});
73+
chart.render();
74+
</script>
75+
</body>
76+
</html>

0 commit comments

Comments
 (0)