1 | <!doctype html> |
---|
2 | <html lang="en"> |
---|
3 | <head> |
---|
4 | <title>PieChart - Series Transition</title> |
---|
5 | <meta charset="utf-8" /> |
---|
6 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
---|
7 | <meta name="description" content="%description%" /> |
---|
8 | <meta name="keywords" content="" /> |
---|
9 | <meta name="author" content="ComponentOne" /> |
---|
10 | |
---|
11 | <link href="../../themes/rocket/jquery-wijmo.css" rel="stylesheet" type="text/css" /> |
---|
12 | |
---|
13 | <script src="../../external/jquery-1.8.0.min.js" type="text/javascript"></script> |
---|
14 | <script src="../../external/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script> |
---|
15 | <script src="../../external/globalize.min.js" type="text/javascript"></script> |
---|
16 | <script src="../../external/raphael-min.js" type="text/javascript"></script> |
---|
17 | <script src="../../wijmo/jquery.wijmo.raphael.js" type="text/javascript"></script> |
---|
18 | <script src="../../wijmo/jquery.wijmo.wijchartcore.js" type="text/javascript"></script> |
---|
19 | <script src="../../wijmo/jquery.wijmo.wijpiechart.js" type="text/javascript"></script> |
---|
20 | <style type="text/css"> |
---|
21 | #wijpiechart |
---|
22 | { |
---|
23 | width: 756px; |
---|
24 | height: 475px; |
---|
25 | } |
---|
26 | </style> |
---|
27 | <script id="scriptInit" type="text/javascript"> |
---|
28 | $(document).ready(function () { |
---|
29 | $("#wijpiechart").wijpiechart({ |
---|
30 | radius: 140, |
---|
31 | legend: { visible: true }, |
---|
32 | hint: { |
---|
33 | content: function () { |
---|
34 | return this.data.label + " : " + Globalize.format(this.value / this.total, "p2"); |
---|
35 | } |
---|
36 | }, |
---|
37 | seriesList: createRandomSeriesList() |
---|
38 | }); |
---|
39 | }); |
---|
40 | |
---|
41 | function changeProperties() { |
---|
42 | var animation = {}; |
---|
43 | enabled = $("#chkEnabled").is(":checked"), |
---|
44 | duration = $("#inpDuration").val(), |
---|
45 | easing = $("#selEasing").val(); |
---|
46 | animation.enabled = enabled; |
---|
47 | if (duration && duration.length) { |
---|
48 | animation.duration = parseFloat(duration); |
---|
49 | } |
---|
50 | animation.easing = easing; |
---|
51 | $("#wijpiechart").wijpiechart("option", "seriesTransition", animation); |
---|
52 | } |
---|
53 | |
---|
54 | function reload() { |
---|
55 | $("#wijpiechart").wijpiechart("option", "seriesList", createRandomSeriesList()); |
---|
56 | } |
---|
57 | |
---|
58 | function createRandomSeriesList() { |
---|
59 | var seriesList = [], |
---|
60 | randomDataValuesCount = 6, |
---|
61 | labels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"], |
---|
62 | idx; |
---|
63 | for (idx = 0; idx < randomDataValuesCount; idx++) { |
---|
64 | seriesList.push({ |
---|
65 | label: labels[idx], |
---|
66 | legendEntry: true, |
---|
67 | data: createRandomValue() |
---|
68 | }); |
---|
69 | } |
---|
70 | return seriesList; |
---|
71 | } |
---|
72 | |
---|
73 | function createRandomValue() { |
---|
74 | var val = Math.round(Math.random() * 100); |
---|
75 | return val; |
---|
76 | } |
---|
77 | </script> |
---|
78 | </head> |
---|
79 | <body class="demo-single"> |
---|
80 | <div class="container"> |
---|
81 | <div class="header"> |
---|
82 | <h2> |
---|
83 | Series Transition</h2> |
---|
84 | </div> |
---|
85 | <div class="main demo"> |
---|
86 | <!-- Begin demo markup --> |
---|
87 | <input type="button" value="reload" onclick="reload()" /> |
---|
88 | <div id="wijpiechart" class="ui-widget ui-widget-content ui-corner-all"> |
---|
89 | </div> |
---|
90 | <!-- End demo markup --> |
---|
91 | <div class="demo-options"> |
---|
92 | <!-- Begin options markup --> |
---|
93 | <div> |
---|
94 | <label for="chkEnabled"> |
---|
95 | seriesTransition Settings: Enabled |
---|
96 | </label> |
---|
97 | <input id="chkEnabled" type="checkbox" checked="checked" /> |
---|
98 | <label for="inpDuration"> |
---|
99 | Duration |
---|
100 | </label> |
---|
101 | <input id="inpDuration" type="text" value="1000" /> |
---|
102 | <label for="selEasing"> |
---|
103 | Easing |
---|
104 | </label> |
---|
105 | <select id="selEasing"> |
---|
106 | <option value=">">></option> |
---|
107 | <option value="<"><</option> |
---|
108 | <option value="<>"><></option> |
---|
109 | <option value="backIn">backIn</option> |
---|
110 | <option value="backOut">backOut</option> |
---|
111 | <option value="bounce">bounce</option> |
---|
112 | <option value="elastic">elastic</option> |
---|
113 | </select> |
---|
114 | <input type="button" value="Apply" onclick="changeProperties()" /> |
---|
115 | </div> |
---|
116 | <!-- End options markup --> |
---|
117 | </div> |
---|
118 | </div> |
---|
119 | <div class="footer demo-description"> |
---|
120 | <p>This sample demonstrates how to set the reloadAnimation of your pie charts when reloading data. |
---|
121 | This example uses the <b>seriesTransition</b> options of the pie chart.</p> |
---|
122 | </div> |
---|
123 | </div> |
---|
124 | </body> |
---|
125 | </html> |
---|