jmchart 1.2.7 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,148 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <!--<script type="text/javascript" src="../src/jmchart.debug.js" id="jmgraph" ></script>-->
7
-
8
- <style>
9
- html,body {
10
- margin:0;
11
- padding:0;
12
- width:100%;
13
- height:100%;
14
- }
15
- #mycanvas {
16
- text-align: center;
17
- margin-top: 10px;
18
- }
19
- #mycanvas canvas, #mycanvas div{
20
- background-color:#fff;
21
- margin:0 auto;
22
- }
23
- /*div.jm-tooltip {
24
- background-color: rgba(255,255,255,0.8);
25
- padding:4px;
26
- border:1px solid #000;
27
- box-shadow: 0 0 3px #000;
28
- border-radius: 6px;
29
- }*/
30
- </style>
31
- <script type="module">
32
- import jmChart from '../dist/jmchart.esm.js';
33
- (function load() {
34
- var w = Math.max((window.innerWidth || window.document.body.clientWidth) * 0.8, 500);
35
- var h = Math.min((window.innerHeight || window.document.body.clientHeight) * 0.5, 500);
36
- inichart(w,h);
37
- })();
38
-
39
-
40
- function inichart(w, h) {
41
-
42
- const datacount = 50;
43
-
44
- const chart = new jmChart('mycanvas', {
45
- width: w,
46
- height: h,
47
- xField: 'x',
48
- enableAnimate: true,
49
- legendPosition: 'top',
50
- legendVisible: false, // 不显示图例
51
- // 最大和最小X值, 这里一般不用指定,除非硬是需要
52
- minXValue : 0,
53
- maxXValue : 10,
54
- //minYValue: -100,
55
- //maxYValue: 400,
56
- // 格式化x标签值
57
- xLabelFormat: (v, item, index) => {
58
- // 只展示第一个和最后一个
59
- if(index % 5 === 0) {
60
- return v;
61
- }
62
- return '';
63
- },
64
- style: {
65
- // 跟随标线
66
- markLine: {
67
- x: false, // 显示X标线
68
- y: true, // 显示Y标线
69
- stroke: 'red',
70
- fill: '#fff',
71
- lineWidth: 1,
72
- },
73
- // x轴 Y轴隐藏
74
- axis: {
75
- stroke: 'transparent',
76
- align: 'center', // label居中对齐
77
- grid: {
78
- x: false, // 不显示X轴网格
79
- y: true // 显示Y轴网格
80
- }
81
- },
82
- // 隐藏边框
83
- chartArea: {
84
- stroke: 'transparent'
85
- },
86
- margin: {
87
- top: 30,
88
- left: 50,
89
- right: 10,
90
- bottom: 30
91
- }
92
- }
93
- });
94
-
95
- const line = chart.createSeries('stackLine', {
96
- fields: [
97
- 'y1', 'y2'
98
- ],
99
- //index: 2, // 指定Y轴索引,如是档指定就会共用左边的Y轴,
100
- legendLabel: '图例2',
101
-
102
- // 格式化x轴标签值
103
- yLabelFormat: (v) => {
104
- return v.toFixed? (v.toFixed(0) + '%') : v;
105
- },
106
- style: {
107
- // 不显示小圆点
108
- showItem: false,
109
- color: '#F7BB98',
110
- // 填充图形
111
- area: {
112
- fill: function(style) {
113
- return this.style.color;
114
- },
115
- shadow: function() {
116
- return `0, 0, 20, #000`;
117
- },
118
- }
119
- }
120
- });
121
-
122
-
123
- function animate() {
124
- chart.data = [];
125
- for(var i = 0;i<datacount;i++) {
126
- const d = {
127
- x : '0909' + i,
128
- y1 : i * 2 + Math.random() * 10,
129
- y2: i * 3 + Math.random() * 10
130
- };
131
-
132
- chart.data.push(d);
133
- }
134
-
135
- //setTimeout(animate,500);
136
- chart.refresh();
137
- console.log(chart.data);
138
- }
139
-
140
- animate();
141
- }
142
- </script>
143
- </head>
144
- <body>
145
- <div id="mycanvas">
146
- </div>
147
- </body>
148
- </html>
package/example/test.html DELETED
@@ -1,94 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <!--<script type="text/javascript" src="../src/jmchart.debug.js" id="jmgraph" ></script>-->
7
-
8
- <style>
9
- html,body {
10
- margin:0;
11
- padding:10px;
12
- width:100%;
13
- height:100%;
14
- }
15
- #mycanvas canvas, #mycanvas div{
16
- background-color:#fff;
17
- margin:0 auto;
18
- }
19
- /*div.jm-tooltip {
20
- background-color: rgba(255,255,255,0.8);
21
- padding:4px;
22
- border:1px solid #000;
23
- box-shadow: 0 0 3px #000;
24
- border-radius: 6px;
25
- }*/
26
- </style>
27
- <script type="module">
28
- //window.devicePixelRatio = 1;
29
- import { jmChart } from '../dist/jmchart.esm.js';
30
-
31
- (function load() {
32
- var w = Math.max((window.innerWidth || window.document.body.clientWidth) * 0.9, 600);
33
- var h = Math.max((window.innerHeight || window.document.body.clientHeight) * 0.6, 200);
34
- inichart(w,h);
35
- })();
36
-
37
-
38
- function inichart(w, h) {
39
- var chart = new jmChart('mycanvas', {
40
- width: w,
41
- height: h,
42
- xField: 'date',
43
- //baseY: 0,
44
- enableAnimate: true,
45
- autoRefresh: true,
46
-
47
- style: {
48
- margin: {
49
- left: 50
50
- },
51
- legend: {
52
- legendPosition: 'top'
53
- }
54
- }
55
- });
56
- //chart.legend.legendPosition = 'top';
57
- chart.legend.visible = true;
58
-
59
- // touch改变数据点事件
60
- chart.on('touchPointChange', function(args) {
61
- console.log(args);
62
- });
63
-
64
- var line1 = chart.createSeries('line', {
65
- field: 'nav',
66
- //index: 2, // 指定Y轴索引,如是档指定就会共用左边的Y轴,
67
- // 最大值和最小值,如果不指定会自动计算,
68
- // 如果指定了也只是指定了最大或最小边界,如果有数值超过它,依然以事实数值为准
69
- minYValue: 0.97,
70
- maxYValue: 1.05,
71
- style: {
72
- // 画圆滑的曲线
73
- curve: true,// 填充图形
74
- label: {
75
- show: true
76
- },
77
- },
78
- });
79
-
80
-
81
- chart.data = [ { "since_setup_rise_rate": "0", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "-", "adjusted_nav": 1, "nav": 1, "year1_rise_rate": "-", "date": "2022-06-27", "day7_rise_rate_year": "-", "accumulative_nav": 1, "per_ten_thousands_income": 0, "day1_rise_rate": "-" }, { "since_setup_rise_rate": "0.0025", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "-", "adjusted_nav": 1.0025, "nav": 1.0025, "year1_rise_rate": "-", "date": "2022-07-01", "day7_rise_rate_year": "0", "accumulative_nav": 1.0025, "per_ten_thousands_income": 0, "day1_rise_rate": "0.0025" }, { "since_setup_rise_rate": "0.0023", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "-", "adjusted_nav": 1.0023, "nav": 1.0023, "year1_rise_rate": "-", "date": "2022-07-08", "day7_rise_rate_year": "0", "accumulative_nav": 1.0023, "per_ten_thousands_income": 0, "day1_rise_rate": "-0.0002" }, { "since_setup_rise_rate": "0.0028", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "-", "adjusted_nav": 1.0028, "nav": 1.0028, "year1_rise_rate": "-", "date": "2022-07-15", "day7_rise_rate_year": "0", "accumulative_nav": 1.0028, "per_ten_thousands_income": 0, "day1_rise_rate": "0.000499" }, { "since_setup_rise_rate": "0.0057", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "-", "adjusted_nav": 1.0057, "nav": 1.0057, "year1_rise_rate": "-", "date": "2022-07-22", "day7_rise_rate_year": "0", "accumulative_nav": 1.0057, "per_ten_thousands_income": 0, "day1_rise_rate": "0.002892" }, { "since_setup_rise_rate": "0.0079", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.0079", "adjusted_nav": 1.0079, "nav": 1.0079, "year1_rise_rate": "-", "date": "2022-07-29", "day7_rise_rate_year": "0", "accumulative_nav": 1.0079, "per_ten_thousands_income": 0, "day1_rise_rate": "0.002188" }, { "since_setup_rise_rate": "0.0094", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.006883", "adjusted_nav": 1.0094, "nav": 1.0094, "year1_rise_rate": "-", "date": "2022-08-05", "day7_rise_rate_year": "0", "accumulative_nav": 1.0094, "per_ten_thousands_income": 0, "day1_rise_rate": "0.001488" }, { "since_setup_rise_rate": "0.0103", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.007982", "adjusted_nav": 1.0103, "nav": 1.0103, "year1_rise_rate": "-", "date": "2022-08-12", "day7_rise_rate_year": "0", "accumulative_nav": 1.0103, "per_ten_thousands_income": 0, "day1_rise_rate": "0.000892" }, { "since_setup_rise_rate": "0.0164", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.013562", "adjusted_nav": 1.0164, "nav": 1.0164, "year1_rise_rate": "-", "date": "2022-08-19", "day7_rise_rate_year": "0", "accumulative_nav": 1.0164, "per_ten_thousands_income": 0, "day1_rise_rate": "0.006038" }, { "since_setup_rise_rate": "0.0155", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.009744", "adjusted_nav": 1.0155, "nav": 1.0155, "year1_rise_rate": "-", "date": "2022-08-26", "day7_rise_rate_year": "0", "accumulative_nav": 1.0155, "per_ten_thousands_income": 0, "day1_rise_rate": "-0.000885" }, { "since_setup_rise_rate": "0.0168", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.00883", "adjusted_nav": 1.0168, "nav": 1.0168, "year1_rise_rate": "-", "date": "2022-09-02", "day7_rise_rate_year": "-", "accumulative_nav": 1.0168, "per_ten_thousands_income": 0, "day1_rise_rate": "0.00128" }, { "since_setup_rise_rate": "0.0193", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.009808", "adjusted_nav": 1.0193, "nav": 1.0193, "year1_rise_rate": "-", "date": "2022-09-09", "day7_rise_rate_year": "-", "accumulative_nav": 1.0193, "per_ten_thousands_income": 0, "day1_rise_rate": "0.002459" }, { "since_setup_rise_rate": "0.0256", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.015144", "adjusted_nav": 1.0256, "nav": 1.0256, "year1_rise_rate": "-", "date": "2022-09-16", "day7_rise_rate_year": "-", "accumulative_nav": 1.0256, "per_ten_thousands_income": 0, "day1_rise_rate": "0.006181" }, { "since_setup_rise_rate": "0.0287", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.012102", "adjusted_nav": 1.0287, "nav": 1.0287, "year1_rise_rate": "-", "date": "2022-09-23", "day7_rise_rate_year": "-", "accumulative_nav": 1.0287, "per_ten_thousands_income": 0, "day1_rise_rate": "0.003023" }, { "since_setup_rise_rate": "0.0287", "month6_rise_rate": "-", "month3_rise_rate": "0.0287", "month1_rise_rate": "0.012999", "adjusted_nav": 1.0287, "nav": 1.0287, "year1_rise_rate": "-", "date": "2022-09-30", "day7_rise_rate_year": "-", "accumulative_nav": 1.0287, "per_ten_thousands_income": 0, "day1_rise_rate": "0" }, { "since_setup_rise_rate": "0.0299", "month6_rise_rate": "-", "month3_rise_rate": "0.027537", "month1_rise_rate": "0.010399", "adjusted_nav": 1.0299, "nav": 1.0299, "year1_rise_rate": "-", "date": "2022-10-14", "day7_rise_rate_year": "-", "accumulative_nav": 1.0299, "per_ten_thousands_income": 0, "day1_rise_rate": "0.001167" }, { "since_setup_rise_rate": "0.0316", "month6_rise_rate": "-", "month3_rise_rate": "0.02872", "month1_rise_rate": "0.00585", "adjusted_nav": 1.0316, "nav": 1.0316, "year1_rise_rate": "-", "date": "2022-10-21", "day7_rise_rate_year": "-", "accumulative_nav": 1.0316, "per_ten_thousands_income": 0, "day1_rise_rate": "0.001651" }, { "since_setup_rise_rate": "0.0282", "month6_rise_rate": "-", "month3_rise_rate": "0.022372", "month1_rise_rate": "-0.000486", "adjusted_nav": 1.0282, "nav": 1.0282, "year1_rise_rate": "-", "date": "2022-10-28", "day7_rise_rate_year": "-", "accumulative_nav": 1.0282, "per_ten_thousands_income": 0, "day1_rise_rate": "-0.003296" } ];
82
-
83
- chart.refresh();
84
-
85
-
86
- }
87
-
88
- </script>
89
- </head>
90
- <body>
91
- <div id="mycanvas">
92
- </div>
93
- </body>
94
- </html>
package/example/vue.html DELETED
@@ -1,329 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <script src="js/vue_2.6.14.min.js"></script>
7
-
8
- <style>
9
- html,body {
10
- margin:0;
11
- padding:0;
12
- width:100%;
13
- height:100%;
14
- background-color: #000;
15
- }
16
- #app {
17
- height: 100%;
18
- margin: 10px;
19
- }
20
- /*div.jm-tooltip {
21
- background-color: rgba(255,255,255,0.8);
22
- padding:4px;
23
- border:1px solid #000;
24
- box-shadow: 0 0 3px #000;
25
- border-radius: 6px;
26
- }*/
27
- .floatdiv {
28
- position:absolute;background:red;top:0;left:0;
29
- }
30
- </style>
31
-
32
- </head>
33
- <body>
34
- <div id="app">
35
- <v-chart v-if="visible" :chart-data="chartData" ref="mychart"
36
- :chart-options="chartOptions"
37
- :chart-series="chartSeries"
38
- v-on:touch-point-change="touchPointChange"
39
- v-on:touchstart="touchstart"
40
- v-on:touchmove="touchmove"
41
- v-on:touchend="touchend"
42
- v-on:touchleave="touchleave"
43
- v-on:markline-move="marklineMove"
44
- :width="width" :height="height">
45
-
46
- </v-chart>
47
-
48
- <div :style="{top: floattop, left: flaotleft}" class="floatdiv">浮窗</div>
49
-
50
- <button @click="visible=!visible">显示/隐藏</button>
51
-
52
- <button @click="changeField">换field</button>
53
-
54
- <button @click="showTooltip">展示浮窗</button>
55
- <br />
56
- <div style="color: #ccc; font-size: 12px; overflow: hidden">
57
- {{ touchDataInfo }}
58
- </div>
59
- </div>
60
- <script type="module">
61
- import { vChart } from '../dist/jmchart.esm.js';
62
-
63
- const options = {
64
- //width: 800, // 可以这里指定,也可以VUE属性指定
65
- //height: 600,
66
- xField: 'x',// X轴对应在数据中的字段名
67
- enableAnimate: true,
68
- touchGraph: true, // 是否依赖生成操作图层,当点比较多时,性能低下可以把它设为true
69
- autoRefresh: true,
70
- legendPosition: 'top', // 图例位置 top left right bottom
71
- legendVisible: false, // 不显示图例
72
- // 最大和最小X值, 这里一般不用指定,除非硬是需要
73
- minXValue : 0,
74
- maxXValue : 10,
75
- // 格式化x标签值
76
- xLabelFormat: function(v, item, index) {
77
- if(!this.data) return;
78
- // 只展示第一个和最后一个
79
- if(index == 0 || index == Math.floor(this.data.length/2) || index == this.data.length - 1) {
80
- return v + '';
81
- }
82
- return '';
83
- },
84
- style: {
85
- margin:{
86
- left: 60,
87
- top: 20,
88
- right: 20,
89
- bottom: 30
90
- },
91
- // x轴 Y轴隐藏
92
- axis: {
93
- stroke: 'transparent',
94
- align: 'center', // 轴标签往中间靠。不出二边
95
- grid: {
96
- x: true, // 不显示X轴网格
97
- y: false, // 显示Y轴网格
98
- stroke: '#292921',
99
- lineWidth: 1,
100
- },
101
- xLabel: {
102
- fill: '#fff', // 轴上的字颜色
103
- font: `12px PingFangSC-Regular`,
104
- margin: {
105
- top: 10
106
- }
107
- },
108
- yLabel: {
109
- count: 4,
110
- fill: 'green', // 轴上的字颜色
111
- textAlign: 'right',
112
- textBaseline: 'middle',
113
- font: `16px PingFangSC-Regular`,
114
- margin: {
115
- right: 2
116
- }
117
- }
118
- },
119
- // 跟随标线
120
- markLine: {
121
- x: true, // 显示X标线
122
- y: true, // 显示Y标线
123
- fill: '#000',
124
- lineWidth: 1
125
- //lineType: 'dotted' // 虚线 待优化,会卡住
126
- },
127
- // 隐藏边框
128
- chartArea: {
129
- stroke: 'transparent'
130
- }
131
- }
132
- };
133
-
134
-
135
-
136
- const ser1 = {
137
- type: 'line', // line bar pie spline
138
- field: 'y1', // 当前图绑定的数据字段名
139
- legendLabel: '图例2',
140
- // 最大值和最小值,如果不指定会自动计算,
141
- // 如果指定了也只是指定了最大或最小边界,如果有数值超过它,依然以事实数值为准
142
- minYValue: 0.95,
143
- maxYValue: 1.5,
144
- // 格式化y轴标签值
145
- yLabelFormat: function(v) {
146
- return v.toFixed? (v.toFixed(2)+ '%') : v;
147
- },
148
- style: {
149
- // 不显示小圆点
150
- showItem: false,
151
- //color: '#C79156', // 自定义颜色,如果不指定就会采用默认的
152
- curve: true, // 圆滑的曲线,
153
- lineWidth: 1,
154
- aniCount: 100, // 动画最多刷新多少次, 越大越平顺但越慢
155
- // 填充图形
156
- area: {
157
- // 自定义填充颜色处理
158
- fill: function(style) {
159
- // 根据颜色生成渐变效果
160
- const color = this.graph.utils.hexToRGBA(this.style.stroke);
161
- return `linear-gradient(50% 0 50% 100%,
162
- rgba(${color.r},${color.g},${color.b}, 0) 1,
163
- rgba(${color.r},${color.g},${color.b}, 0) 0.8,
164
- rgba(${color.r},${color.g},${color.b}, 0.2) 0.5,
165
- rgba(${color.r},${color.g},${color.b}, 0.8) 0)`;
166
- }
167
- }
168
- }
169
- };
170
-
171
- const ser2 = {
172
- type: 'line', // line bar pie spline
173
- field: 'y2', // 当前图绑定的数据字段名
174
- legendLabel: '图例2',
175
- // 最大值和最小值,如果不指定会自动计算,
176
- // 如果指定了也只是指定了最大或最小边界,如果有数值超过它,依然以事实数值为准
177
- //minYValue: 0,
178
- maxYValue: 1.15,
179
- lineWidth: 1,
180
- // 格式化y轴标签值
181
- yLabelFormat: (v) => {
182
- return v.toFixed? (v.toFixed(2) + '%') : v;
183
- },
184
- style: {
185
- //curve: true,
186
- // 不显示小圆点
187
- showItem: false,
188
- // 填充图形
189
- area: {
190
- // 自定义填充颜色处理
191
- fill: function(style) {
192
- // 根据颜色生成渐变效果
193
- const color = this.graph.utils.hexToRGBA(this.style.stroke);
194
- return `linear-gradient(50% 0 50% 100%,
195
- rgba(${color.r},${color.g},${color.b}, 0) 1,
196
- rgba(${color.r},${color.g},${color.b}, 0) 0.8,
197
- rgba(${color.r},${color.g},${color.b}, 0.3) 0.5,
198
- rgba(${color.r},${color.g},${color.b}, 0.5) 0.2,
199
- rgba(${color.r},${color.g},${color.b}, 0.8) 0)`;
200
- }
201
- }
202
- }
203
- };
204
-
205
- const app = new Vue({
206
- el: '#app',
207
- data: {
208
- visible: true,
209
- chartData: [],
210
- // 图表配置
211
- chartOptions: options,
212
- // 图,可以指定多个
213
- chartSeries: [
214
- ser1,
215
- ser2
216
- ],
217
- width: '100%',
218
- height: '50%',
219
- touchDataInfo: '',
220
- floattop: '0px',
221
- flaotleft: '0px'
222
- },
223
- components: {
224
- vChart
225
- },
226
- methods: {
227
- // 滑动改变数据点
228
- touchPointChange: (args) => {
229
- console.log(args);
230
- app.touchDataInfo = JSON.stringify(args);
231
- },
232
- touchstart: (args) => {
233
- //console.log('touchstart', args);
234
- },
235
- touchmove: (args) => {
236
- //console.log('touchmove', args);
237
- },
238
- touchend: (args) => {
239
- //console.log('touchend', args);
240
- },
241
- touchleave: (args) => {
242
- // 滑动离开事件,滑到外面去了
243
- //console.log('touchleave', args);
244
- },
245
- marklineMove(args) {
246
- console.log('mark line move', args);
247
- if(args.event) {
248
- args.event.preventDefault();// 阻止默认行为
249
- args.event.stopPropagation();
250
- }
251
- },
252
- changeField() {
253
- //series[0].field == 'y2'?series[0].field = 'y3':series[0].field = 'y2';
254
-
255
- this.chartSeries = this.chartSeries.includes(ser1)?[
256
- ser2
257
- ]: [
258
- ser1
259
- ];
260
- // 可以停用动画
261
- //ser1.enableAnimate = false;
262
- this.$refs.mychart.refresh();// 改变基础属性需要重刷
263
- },
264
- showTooltip() {
265
- let point = this.$refs.mychart.chartInstance.series[0].getDataPointByXValue('2019-05-25');
266
- console.log(point);
267
-
268
-
269
-
270
- const chartarea = this.$refs.mychart.chartInstance.chartArea.getBounds();
271
- let x = chartarea.left + point.x;
272
- let y = chartarea.top + point.y;
273
-
274
- const p2 = this.$refs.mychart.chartInstance.pointToPixes({
275
- x,
276
- y
277
- });
278
-
279
- this.floattop = p2.y + 'px';
280
- this.flaotleft = p2.x + 'px';
281
- }
282
- }
283
- });
284
-
285
- (function load() {
286
- //var w = Math.max((window.innerWidth || window.document.body.clientWidth) * 0.8, 400);
287
- //var h = Math.min((window.innerHeight || window.document.body.clientHeight) * 0.5, 280);
288
- app.chartData = [];
289
- inichart();
290
-
291
- //setTimeout(()=>{
292
- // app.width = "800px";
293
- //}, 1000)
294
- })();
295
-
296
-
297
- function inichart() {
298
-
299
- const datacount = 200;
300
-
301
- // 动态加入数据
302
- function animate() {
303
- const data = [];
304
- for(let i =0; i<datacount; i++) {
305
- const d = {
306
- x : '2019-05-' + i,
307
- y1: Math.random()/2 + 0.5,
308
- y2: Math.random(),
309
- y3: Math.random(),
310
- };
311
-
312
- if(data.length < datacount) {
313
- data.push(d);
314
-
315
- //setTimeout(animate, 200); // 一直加
316
- }
317
- else {
318
- data.shift();
319
- data.push(d);
320
- }
321
- }
322
- app.chartData = data;
323
- }
324
-
325
- animate();
326
- }
327
- </script>
328
- </body>
329
- </html>