| <!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"> |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| <script src="lib/simpleRequire.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="ut/lib/canteen.js"></script> --> |
| <link rel="stylesheet" href="lib/reset.css" /> |
| </head> |
| <body> |
| <style> |
| </style> |
| |
| |
| |
| <div id="main0-log"></div> |
| <div id="main0-polar"></div> |
| <div id="main1"></div> |
| <div id="main2"></div> |
| <div id="main3"></div> |
| |
| |
| |
| |
| |
| |
| <script> |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| let option; |
| |
| const data = []; |
| data.push([10, 100]); |
| data.push([80, 120]); |
| data.push([9000, 130]); |
| |
| option = { |
| tooltip: { |
| show: true, |
| trigger: 'axis', |
| }, |
| xAxis: [{ |
| type: 'log', |
| axisLabel: { |
| showMinLabel: true, |
| showMaxLabel: true |
| } |
| }], |
| yAxis: { |
| type: 'value', |
| min: 'dataMin', |
| axisLabel: { |
| formatter: n => n.toFixed(2) |
| } |
| }, |
| series: [{ |
| type: 'line', |
| data: data, |
| label: {show: true}, |
| symbolSize: 0 |
| }] |
| }; |
| |
| var chart = testHelper.create(echarts, 'main0-log', { |
| title: [ |
| 'Snap with log axis', |
| 'axisPointer should snap to the nearest data point in view coordinate', |
| 'When mouse moves to x value at 1000, it should snap to value 9000 instead of 80' |
| ], |
| option: option |
| }); |
| |
| if (chart) { |
| const coord = chart.convertToPixel({ |
| seriesIndex: 0, |
| xAxisIndex: 0, |
| yAxisIndex: 0 |
| }, [1000, 120]); |
| |
| chart.dispatchAction({ |
| type: 'showTip', |
| x: coord[0], |
| y: coord[1] |
| }); |
| } |
| }); |
| </script> |
| |
| |
| |
| <script> |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| let option; |
| |
| const data = [ |
| [0, 0], |
| [20, 30], |
| [80, 150], |
| [90, 270] |
| ]; |
| |
| option = { |
| tooltip: { |
| show: true, |
| trigger: 'axis', |
| }, |
| polar: {}, |
| radiusAxis: [{ |
| type: 'value', |
| axisLabel: { |
| showMinLabel: true, |
| showMaxLabel: true |
| } |
| }], |
| angleAxis: { |
| type: 'value', |
| min: 0, |
| max: 360, |
| axisLabel: { |
| formatter: n => n.toFixed(2) |
| } |
| }, |
| series: [{ |
| type: 'line', |
| data: data, |
| symbolSize: 0, |
| coordinateSystem: 'polar' |
| }] |
| }; |
| |
| var chart = testHelper.create(echarts, 'main0-polar', { |
| title: [ |
| 'Snap with polar axis', |
| 'axisPointer should snap to the nearest data point in view coordinate', |
| 'When mouse moves to angle value a little smaller than 90, it should snap to value 30;', |
| 'When mouse moves to angle value a little larger than 90, it should snap to value 150' |
| ], |
| option: option |
| }); |
| |
| if (chart) { |
| const coord = chart.convertToPixel({ |
| seriesIndex: 0, |
| angleAxisIndex: 0, |
| radiusAxisIndex: 0 |
| }, [30, 92]); |
| |
| chart.dispatchAction({ |
| type: 'showTip', |
| x: coord[0], |
| y: coord[1] |
| }); |
| } |
| }); |
| </script> |
| |
| |
| |
| <script> |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| let option; |
| |
| const data = []; |
| const date = new Date('2024-04-09 9:30:00'); |
| const endTime = new Date('2024-04-09 15:00:00').getTime(); |
| const breakStart = new Date('2024-04-09 11:30:00'); |
| const breakEnd = new Date('2024-04-09 13:00:00'); |
| data.push([new Date('2024-04-09 10:30:00').getTime(), 100]); |
| data.push([new Date('2024-04-09 13:30:00').getTime(), 120]); |
| data.push([new Date('2024-04-09 13:40:00').getTime(), 130]); |
| |
| option = { |
| tooltip: { |
| show: true, |
| trigger: 'axis', |
| }, |
| xAxis: [{ |
| type: 'time', |
| min: new Date('2024-04-09 9:30:00'), |
| max: new Date('2024-04-09 15:00:00'), |
| axisLabel: { |
| showMinLabel: true, |
| showMaxLabel: true |
| } |
| }], |
| yAxis: { |
| type: 'value', |
| min: 'dataMin', |
| axisLabel: { |
| formatter: n => n.toFixed(2) |
| } |
| }, |
| series: [{ |
| type: 'line', |
| data: data, |
| symbolSize: 0 |
| }] |
| }; |
| |
| var chart = testHelper.create(echarts, 'main1', { |
| title: [ |
| 'Snap with break axis (time axis)' |
| ], |
| option: option |
| }); |
| }); |
| </script> |
| |
| |
| |
| |
| <script> |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| let option; |
| |
| const data = []; |
| data.push([10.5, 100]); |
| data.push([13.5, 120]); |
| data.push([13.67, 130]); |
| |
| option = { |
| tooltip: { |
| show: true, |
| trigger: 'axis', |
| }, |
| xAxis: [{ |
| type: 'value', |
| min: 9.5, |
| max: 15, |
| axisLabel: { |
| showMinLabel: true, |
| showMaxLabel: true, |
| breakFormatter: (value, index, start, end, gap) => { |
| return '11:30/13:00' |
| } |
| }, |
| breaks: [{ |
| start: 11.5, |
| end: 13, |
| gap: 0 |
| }], |
| breakArea: { |
| zigzagAmplitude: 0 |
| } |
| }], |
| yAxis: { |
| type: 'value', |
| min: 'dataMin', |
| axisLabel: { |
| formatter: n => n.toFixed(2) |
| } |
| }, |
| series: [{ |
| type: 'line', |
| data: data, |
| symbolSize: 0 |
| }] |
| }; |
| |
| var chart = testHelper.create(echarts, 'main2', { |
| title: [ |
| 'Snap with break axis (value axis)' |
| ], |
| option: option |
| }); |
| }); |
| </script> |
| |
| |
| |
| |
| |
| <script> |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| let option; |
| |
| const data = []; |
| const date = new Date('2024-04-09 9:30:00'); |
| const endTime = new Date('2024-04-09 15:00:00').getTime(); |
| const breakStart = new Date('2024-04-09 11:30:00'); |
| const breakEnd = new Date('2024-04-09 13:00:00'); |
| data.push([new Date('2024-04-09 10:30:00').getTime(), 100]); |
| data.push([new Date('2024-04-09 13:30:00').getTime(), 120]); |
| data.push([new Date('2024-04-09 13:40:00').getTime(), 130]); |
| |
| option = { |
| tooltip: { |
| show: true, |
| trigger: 'axis', |
| }, |
| xAxis: [{ |
| type: 'time', |
| min: new Date('2024-04-09 9:30:00'), |
| max: new Date('2024-04-09 15:00:00'), |
| axisLabel: { |
| showMinLabel: true, |
| showMaxLabel: true, |
| breakFormatter: (value, index, start, end, gap) => { |
| return '11:30/13:00' |
| } |
| }, |
| breaks: [{ |
| start: breakStart, |
| end: breakEnd, |
| gap: 0 |
| }], |
| breakArea: { |
| zigzagAmplitude: 0 |
| } |
| }], |
| yAxis: { |
| type: 'value', |
| min: 'dataMin', |
| axisLabel: { |
| formatter: n => n.toFixed(2) |
| } |
| }, |
| series: [{ |
| type: 'line', |
| data: data, |
| symbolSize: 0 |
| }] |
| }; |
| |
| var chart = testHelper.create(echarts, 'main3', { |
| title: [ |
| 'Snap with break axis (time axis)' |
| ], |
| option: option |
| }); |
| }); |
| </script> |
| |
| |
| </body> |
| </html> |
| |