-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathchart_demo_json.html
More file actions
65 lines (53 loc) · 1.71 KB
/
Copy pathchart_demo_json.html
File metadata and controls
65 lines (53 loc) · 1.71 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
57
58
59
60
61
62
63
64
65
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>ZingChart Backbone Plugin - Example using JSON</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<script src="https://cdn.zingchart.com/zingchart.min.js"></script>
<script src="../lib/backbone.zingchart.min.js"></script>
<script type="text/template" id="chart-template">
<div id="chartDiv"></div>
</script>
<body>
<div id="demo"></div>
<script>
var DemoView = Backbone.View.extend({
el: '#demo',
template: _.template($('#chart-template').html()),
initialize: function() {
this.$el.empty();
var json = {
"type":"pie",
"series":[
{
"text":"Apples",
"values":[5]
},
{
"text":"Oranges",
"values":[8]
},
{
"text":"Bananas",
"values":[22]
}
]
};
this.zc = new ZingChart.ZingChartModel({json: json});
this.render();
},
render: function() {
this.$el.html(this.template());
this.zcView = new ZingChart.ZingChartView({model: this.zc, el: $('#chartDiv')});
this.zcView.render();
return this;
}
});
var demo = new DemoView();
demo.render();
</script>
</body>
</html>