| <!DOCTYPE html> | 
 | <!-- | 
 | Licensed to the Apache Software Foundation (ASF) under one | 
 | or more contributor license agreements.  See the NOTICE file | 
 | distributed with this work for additional information | 
 | regarding copyright ownership.  The ASF licenses this file | 
 | to you under the Apache License, Version 2.0 (the | 
 | "License"); you may not use this file except in compliance | 
 | with the License.  You may obtain a copy of the License at | 
 |  | 
 |    http://www.apache.org/licenses/LICENSE-2.0 | 
 |  | 
 | Unless required by applicable law or agreed to in writing, | 
 | software distributed under the License is distributed on an | 
 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | 
 | KIND, either express or implied.  See the License for the | 
 | specific language governing permissions and limitations | 
 | under the License. | 
 | --> | 
 |  | 
 |  | 
 | <html> | 
 |     <head> | 
 |         <meta charset="utf-8"> | 
 |         <script src="lib/simpleRequire.js"></script> | 
 |         <script src="lib/config.js"></script> | 
 |         <script src="lib/testHelper.js"></script> | 
 |         <meta name="viewport" content="width=device-width, initial-scale=1" /> | 
 |         <link rel="stylesheet" href="lib/reset.css"> | 
 |     </head> | 
 |     <body> | 
 |         <style> | 
 |             h1 { | 
 |                 line-height: 60px; | 
 |                 height: 60px; | 
 |                 background: #ddd; | 
 |                 text-align: center; | 
 |                 font-weight: bold; | 
 |                 font-size: 14px; | 
 |             } | 
 |             .chart { | 
 |                 height: 350px; | 
 |             } | 
 |         </style> | 
 |  | 
 |         <h1>Shift</h1> | 
 |           <div class="chart" id="shift"></div> | 
 |         <h1>Range stick to value</h1> | 
 |          <div class="chart" id="value"></div> | 
 |  | 
 |  | 
 |         <script> | 
 |  | 
 |             var echarts; | 
 |             var chart; | 
 |             var myChart; | 
 |  | 
 |             require([ | 
 |                 'echarts' | 
 |             ], function (ec) { | 
 |  | 
 |                 echarts = ec; | 
 |  | 
 |                 var app = {}; | 
 |  | 
 |                 var option = { | 
 |                     title : { | 
 |                         text: '动态数据', | 
 |                         subtext: '纯属虚构' | 
 |                     }, | 
 |                     tooltip : { | 
 |                         trigger: 'axis' | 
 |                     }, | 
 |                     legend: { | 
 |                         data:['最新成交价'] | 
 |                     }, | 
 |                     toolbox: { | 
 |                         show : true, | 
 |                         feature : { | 
 |                             dataZoom : { | 
 |                                 yAxisIndex: false | 
 |                             }, | 
 |                         } | 
 |                     }, | 
 |                     dataZoom : [{ | 
 |                         type: 'inside', | 
 |                         start : 0, | 
 |                         end : 100 | 
 |                     }, | 
 |                     { | 
 |                         type: 'slider', | 
 |                         start : 0, | 
 |                         end : 100 | 
 |                     } | 
 |                     ], | 
 |                     xAxis : [ | 
 |                         { | 
 |                             type : 'value', | 
 |                             scale: true | 
 |                         } | 
 |                     ], | 
 |                     yAxis : [ | 
 |                         { | 
 |                             type : 'value', | 
 |                             scale: true, | 
 |                             name : '预购量', | 
 |                             max: 1200, | 
 |                             min: 0, | 
 |                             boundaryGap: [0.2, 0.2] | 
 |                         } | 
 |                     ], | 
 |                     series : [ | 
 |                         { | 
 |                             name:'最新成交价', | 
 |                             type:'line', | 
 |                             data:(function (){ | 
 |                                 var res = []; | 
 |                                 var len = 0; | 
 |                                 while (len < 10) { | 
 |                                     var n = [ | 
 |                                         len, | 
 |                                         (Math.random()*10 + 5).toFixed(1) | 
 |                                     ]; | 
 |                                     res.push({name: n[0], value: n}); | 
 |                                     len++; | 
 |                                 } | 
 |                                 return res; | 
 |                             })(), | 
 |                             animation: true, | 
 |                             animationDurationUpdate: 500, | 
 |                             animationEasing: 'linear', | 
 |                             animationEasingUpdate: 'linear' | 
 |                         } | 
 |                     ] | 
 |                 }; | 
 |  | 
 |                 var myChart = testHelper.createChart(echarts, 'shift', option); | 
 |  | 
 |                 if (!myChart) { | 
 |                     return; | 
 |                 } | 
 |  | 
 |                 clearInterval(app.timeTicket); | 
 |                 app.count = 11; | 
 |                 app.timeTicket = setInterval(function (){ | 
 |                     var data0 = option.series[0].data; | 
 |                     data0.shift(); | 
 |                     var lastData = data0[data0.length - 1].value; | 
 |                     var x = [lastData[0] + 1, Math.round(Math.random() * 1000)]; | 
 |  | 
 |                     data0.push({name: x[0], value: x}); | 
 |  | 
 |                     myChart.setOption({series: option.series}); | 
 |                 }, 2100); | 
 |             }); | 
 |  | 
 |         </script> | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |         <script> | 
 |  | 
 |             var echarts; | 
 |             var chart; | 
 |             var myChart; | 
 |  | 
 |             require([ | 
 |                 'echarts' | 
 |             ], function (ec) { | 
 |  | 
 |                 echarts = ec; | 
 |  | 
 |                 var app = {}; | 
 |  | 
 |                 var option = { | 
 |                     title : { | 
 |                         text: '动态数据', | 
 |                         subtext: '纯属虚构' | 
 |                     }, | 
 |                     tooltip : { | 
 |                         trigger: 'axis' | 
 |                     }, | 
 |                     legend: { | 
 |                         data:['最新成交价'] | 
 |                     }, | 
 |                     toolbox: { | 
 |                         show : true, | 
 |                         feature : { | 
 |                             dataZoom : { | 
 |                                 yAxisIndex: false | 
 |                             }, | 
 |                         } | 
 |                     }, | 
 |                     dataZoom : [{ | 
 |                         type: 'inside', | 
 |                         start : 0, | 
 |                         endValue : 8, | 
 |                         rangeMode: ['value', 'value'] | 
 |                     }, | 
 |                     { | 
 |                         type: 'slider', | 
 |                         start : 0, | 
 |                         endValue : 8, | 
 |                         rangeMode: ['value', 'value'] | 
 |                     } | 
 |                     ], | 
 |                     xAxis : [ | 
 |                         { | 
 |                             type : 'value', | 
 |                             scale: true | 
 |                         } | 
 |                     ], | 
 |                     yAxis : [ | 
 |                         { | 
 |                             type : 'value', | 
 |                             scale: true, | 
 |                             name : '预购量', | 
 |                             max: 1200, | 
 |                             min: 0, | 
 |                             boundaryGap: [0.2, 0.2] | 
 |                         } | 
 |                     ], | 
 |                     series : [ | 
 |                         { | 
 |                             name:'最新成交价', | 
 |                             type:'line', | 
 |                             data:(function (){ | 
 |                                 var res = []; | 
 |                                 var len = 0; | 
 |                                 while (len < 10) { | 
 |                                     var n = [ | 
 |                                         len, | 
 |                                         (Math.random()*10 + 5).toFixed(1) | 
 |                                     ]; | 
 |                                     res.push({name: n[0], value: n}); | 
 |                                     len++; | 
 |                                 } | 
 |                                 return res; | 
 |                             })(), | 
 |                             animation: true, | 
 |                             animationDurationUpdate: 500, | 
 |                             animationEasing: 'linear', | 
 |                             animationEasingUpdate: 'linear' | 
 |                         } | 
 |                     ] | 
 |                 }; | 
 |  | 
 |                 var myChart = testHelper.createChart(echarts, 'value', option); | 
 |  | 
 |                 if (!myChart) { | 
 |                     return; | 
 |                 } | 
 |  | 
 |                 clearInterval(app.timeTicket); | 
 |                 app.count = 11; | 
 |                 app.timeTicket = setInterval(function (){ | 
 |                     var data0 = option.series[0].data; | 
 |                     var lastData = data0[data0.length - 1].value; | 
 |                     var x = [lastData[0] + 1, Math.round(Math.random() * 1000)]; | 
 |  | 
 |                     data0.push({name: x[0], value: x}); | 
 |  | 
 |                     myChart.setOption({series: option.series}); | 
 |                     app.count++; | 
 |  | 
 |                     if (app.count > 300) { | 
 |                         clearInterval(app.timeTicket); | 
 |                     } | 
 |                 }, 2100); | 
 |             }); | 
 |  | 
 |         </script> | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |  | 
 |     </body> | 
 | </html> |