| <!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/esl.js"></script> |
| <script src="lib/config.js"></script> |
| <script src="lib/jquery.min.js"></script> |
| <script src="lib/facePrint.js"></script> |
| <script src="lib/testHelper.js"></script> |
| <script src="lib/draggable.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: #a60; |
| text-align: center; |
| font-weight: bold; |
| color: #eee; |
| font-size: 14px; |
| } |
| |
| .chart { |
| height: 500px; |
| } |
| </style> |
| |
| <div class="chart" id="mainA"></div> |
| <div class="chart" id="main0"></div> |
| <div class="chart" id="main1"></div> |
| <h1>[ Test time axis interval ] should not overlap when data zoom.</h1> |
| <div class="chart" id="main2"></div> |
| |
| <h1>Test xAxis.axisTick.interval</h1> |
| <div class="chart" id="main30"></div> |
| <div class="chart" id="main31"></div> |
| <div class="chart" id="main32"></div> |
| <div class="chart" id="main33"></div> |
| <div class="chart" id="main34"></div> |
| <div class="chart" id="main35"></div> |
| |
| <div style="height: 600px;"> |
| <div class="chart" id="main4"></div> |
| </div> |
| |
| <div class="chart" id="main5"></div> |
| |
| |
| <script> |
| |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| |
| var dataCount = 200; |
| var data = []; |
| var d = +new Date(2015, 3, 13); |
| var oneDay = 3600 * 1000; |
| for (var i = 0; i < dataCount; i++) { |
| data.push([d, Math.random()]); |
| d += 2.5 * oneDay; |
| } |
| |
| var startValue = '2015-04-24T04:21'; |
| var endValue = '2015-04-24T10:12'; |
| |
| var option = { |
| tooltip: { |
| trigger: 'axis' |
| }, |
| dataZoom: [{ |
| startValue: startValue, |
| endValue: endValue |
| }, { |
| type: 'inside', |
| startValue: startValue, |
| endValue: endValue |
| }], |
| grid: { |
| left: '3%', |
| right: '4%', |
| bottom: 60, |
| containLabel: true |
| }, |
| xAxis: { |
| type: 'time', |
| minInterval: 3600 * 1000, |
| maxInterval: 3600 * 1000 |
| // splitNumber: 7 |
| }, |
| yAxis: {}, |
| series: [ |
| { |
| type: 'line', |
| data: data |
| } |
| ] |
| }; |
| |
| testHelper.create(echarts, 'mainA', { |
| title: 'xAxis (type: time) should always be 1 hour interval', |
| option: option |
| }); |
| }); |
| |
| </script> |
| |
| |
| |
| |
| |
| |
| |
| <script> |
| |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| |
| option = { |
| tooltip: { |
| trigger: 'axis' |
| }, |
| grid: { |
| left: '3%', |
| right: '4%', |
| bottom: '3%', |
| containLabel: true |
| }, |
| xAxis: [ |
| { |
| type: 'category', |
| boundaryGap: false, |
| data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] |
| } |
| ], |
| yAxis: [ |
| { |
| type: 'value', |
| scale: true, |
| min: 0, |
| minInterval: 1 |
| } |
| ], |
| series: [ |
| { |
| type: 'line', |
| data: [1] |
| } |
| ] |
| }; |
| |
| testHelper.create(echarts, 'main0', { |
| title: '[ Test minInterval ] yAxis: {minInterval: 1, min: 0}, series.data: [1]', |
| option: option |
| }); |
| }); |
| |
| </script> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <script> |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| |
| var categoryData = []; |
| var data = []; |
| var rotate = 0; |
| |
| for (var i = 0; i < 100; i++) { |
| categoryData.push(i + 'longlonglong'); |
| data.push(Math.random() * 1000000); |
| } |
| |
| option = { |
| title: { |
| }, |
| tooltip: { |
| trigger: 'axis' |
| }, |
| grid: [{ |
| height: 50 |
| }, { |
| top: 220, |
| height: 300 |
| }], |
| xAxis: [{ |
| id: 'category', |
| type: 'category', |
| boundaryGap: false, |
| data: categoryData, |
| axisLabel: { |
| rotate: rotate |
| } |
| }, { |
| gridIndex: 1 |
| }], |
| yAxis: [{ |
| }, { |
| id: 'category', |
| type: 'category', |
| boundaryGap: false, |
| data: categoryData, |
| gridIndex: 1, |
| axisLabel: { |
| rotate: rotate |
| } |
| }], |
| series: [ |
| { |
| type: 'line', |
| data: data |
| }, |
| { |
| type: 'line', |
| xAxisIndex: 1, |
| yAxisIndex: 1, |
| data: data |
| } |
| ] |
| }; |
| |
| var chart = testHelper.create(echarts, 'main1', { |
| title: '[ Test category axis interval ] interval of xAxis should be approperiate after rotated.', |
| option: option, |
| height: 600, |
| |
| buttons: [{ |
| text: 'Rotate', |
| onclick: function () { |
| rotate = (rotate + 30) % 360; |
| chart.setOption({ |
| xAxis: { |
| id: 'category', |
| axisLabel: { |
| rotate: rotate |
| } |
| }, |
| yAxis: { |
| id: 'category', |
| axisLabel: { |
| rotate: rotate |
| } |
| } |
| }); |
| } |
| }] |
| }); |
| }); |
| |
| </script> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <script> |
| |
| require([ |
| 'data/rainfall.json', |
| 'echarts' |
| ], function (rainfallData, echarts) { |
| |
| var option = { |
| tooltip: { |
| trigger: 'axis' |
| }, |
| grid: { |
| bottom: 150 |
| }, |
| dataZoom: { |
| show: true, |
| realtime: true, |
| startValue: '2009-09-20 12:00', |
| end: 100 |
| }, |
| xAxis: [ |
| { |
| type: 'time', |
| axisLabel: { |
| formatter: function (value) { |
| return echarts.format.formatTime('yyyy-MM-dd hh:mm:ss', value); |
| } |
| } |
| } |
| ], |
| yAxis: [ |
| { |
| name: '流量(m^3/s)' |
| } |
| ], |
| series: [ |
| { |
| name: '流量', |
| type: 'line', |
| symbol: 'none', |
| itemStyle: {normal: {areaStyle: {type: 'default'}}}, |
| data: rainfallData.flow.map(function (val, idx) { |
| return [+(new Date(rainfallData.category[idx])), val]; |
| }) |
| } |
| ] |
| }; |
| |
| testHelper.createChart(echarts, 'main2', option); |
| }) |
| |
| </script> |
| |
| |
| |
| |
| |
| |
| <script> |
| |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| |
| var testArr = [ |
| [true, false, true, true], |
| [true, false, true, false], |
| [false, true, true, false], |
| [false, true, false, true], |
| [false, false, true, true], |
| [true, true, false, false] |
| ]; |
| |
| function print(index) { |
| return `intervalList:\n[${testArr[index].toString()}] \n\n currentIndex: ${index}` |
| } |
| |
| function makeOption(dataIndex) { |
| var option = { |
| title: { |
| text: print(dataIndex), |
| textStyle: { |
| fontSize: 12 |
| } |
| }, |
| grid: { |
| top: 10, |
| right: 50, |
| left: 160, |
| bottom: 30 |
| }, |
| xAxis: { |
| type: 'category', |
| data: ['Mon', 'Tue', 'Wed', 'Thu'], |
| axisTick: { |
| show: true, |
| interval: function (index) { |
| // return index && !!x2Data[index] |
| return testArr[dataIndex][index] |
| }, |
| length: 30, |
| alignWithLabel: false |
| }, |
| }, |
| yAxis: { |
| type: 'value' |
| }, |
| series: [{ |
| data: [820, 932, 901, 934], |
| type: 'bar' |
| }] |
| }; |
| |
| return option; |
| } |
| |
| for (var i = 0; i < testArr.length; i++) { |
| var dom = document.getElementById('main3' + i); |
| if (dom) { |
| dom.style.height = '90px'; |
| var chart = echarts.init(dom); |
| chart.setOption(makeOption(i)); |
| } |
| } |
| |
| }); |
| |
| </script> |
| |
| |
| |
| <script> |
| |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| |
| var option = { |
| xAxis: { |
| type: 'category', |
| data: ['Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun'], |
| axisLabel: { |
| fontSize: 20 |
| } |
| }, |
| yAxis: { |
| type: 'value' |
| }, |
| series: [{ |
| data: [120, 200, 150, 80, 70, 110, 130], |
| type: 'bar' |
| }] |
| }; |
| |
| |
| testHelper.create(echarts, 'main4', { |
| title: 'Label should not disappear after size changed. #11112', |
| option: option, |
| width: 700, |
| height: 300, |
| draggable: true |
| }); |
| }); |
| </script> |
| |
| |
| |
| |
| <script> |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| |
| var xAxisData = [ |
| 'Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo', 'Libra', |
| 'Scorpio', 'Sagittarius', 'Capricornus', 'Aquarius', 'Pisces' |
| ]; |
| var data0 = []; |
| var data1 = []; |
| var data2 = []; |
| var data3 = []; |
| |
| for (var i = 0; i < xAxisData.length; i++) { |
| data0.push([Math.random() * 100, Math.random() * 30]); |
| data1.push(Math.random() * 30); |
| data2.push([Math.random() * (i % 2 === 0 ? 100 : 1000000), Math.random() * 30]); |
| data3.push([+new Date() + Math.round(Math.random() * 3600 * 24 * 30), Math.random() * 30]); |
| } |
| |
| var height = '18%'; |
| |
| var option = { |
| tooltip: { |
| trigger: 'axis' |
| }, |
| dataZoom: [{ |
| type: 'inside' |
| }, { |
| type: 'slider' |
| }], |
| xAxis: [{ |
| type: 'category', |
| data: xAxisData, |
| height: height, |
| axisTick: { |
| // alignWithLabel: true |
| }, |
| // splitLine: {show: true}, |
| axisPointer: { |
| type: 'shadow' |
| } |
| }], |
| yAxis: { |
| // splitLine: {show: false} |
| }, |
| series: [{ |
| type: 'scatter', |
| symbolSize: function (val) { |
| return val; |
| }, |
| data: data1 |
| }] |
| }; |
| |
| var chart = testHelper.create(echarts, 'main5', { |
| title: 'tick split should be correct', |
| option: option, |
| width: 800, |
| height: 240 |
| // recordCanvas: true |
| }); |
| }); |
| |
| </script> |
| |
| |
| |
| |
| |
| </body> |
| |
| </html> |