/
githubmirror
/
echarts
Обзор
Документация
Войти
/
githubmirror
/
echarts
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/line-animation-update.html
380 строк
148 KB
pissang
fix(line): fix animation is not stopped when direct update points.
15 сен 2021, 12:26
15 сен 2021, 12:26
4824ada
Код
Авторство
О чём код?
<!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/facePrint.js"></script> <script src="lib/testHelper.js"></script> <link rel="stylesheet" href="lib/reset.css" /> </head> <body> <style> .test-title { background: #146402; color: #fff; } </style> <div id="main0"></div> <div id="main1"></div> <div id="main2"></div> <script> /** * Related issues: * - https://github.com/apache/incubator-echarts/issues/10228 * - https://github.com/apache/incubator-echarts/issues/11633 * - https://github.com/apache/incubator-echarts/issues/12164 * - https://github.com/apache/incubator-echarts/issues/12433 */ require([ 'echarts' ], function (echarts) { var chart; var myChart; const obj = {}; const payload = JSON.parse('{"__proto__":{"polluted":"Polluted!"}}'); const datasetSource1 = [['2019-04-14', 17], ['2019-04-16', 13], ['2019-04-17', 5]]; const datasetSource2 = [['2019-04-13', 0], ['2019-04-18', 23]]; const option1 = { dataset: [ { source: datasetSource1, sourceHeader: false } ], dataZoom: [ { show: true } ], xAxis: { type: 'time', min: '2019-04-15', max: '2019-04-18', }, yAxis: [ { scale: true, type: 'value' } ], series: [ { type: 'line', showSymbol: false, animation: false, } ] }; const option2 = { dataset: [ { source: datasetSource2, sourceHeader: false } ], dataZoom: [ { show: true, start: 0, end: 100, } ], xAxis: { type: 'time', min: '2019-04-12', max: '2019-04-19', }, yAxis: [ { scale: true, type: 'value' } ], series: [ { type: 'line', showSymbol: false, } ] }; chart = myChart = testHelper.create(echarts, 'main0', { title: [ 'Lines series should not show extraneous points when updating options', 'Only **one** segment (e.g.: **two** data points) should be displayed after pressing the button' ], option: option1, button: { text: 'Click to trigger extraneous lines bug', onClick: () => { myChart.setOption(option2, true); } } }); }); </script> <script> var chart; var myChart; const datasetSource1 = [['2019-04-14', 17], ['2019-04-16', 13], ['2019-04-17', 5]]; const datasetSource2 = [['2019-04-13', 0], ['2019-04-18', 23]]; require([ 'echarts' ], function (echarts) { var datasetSource1 = [[1554139666196,1554139778499,"17.0000000000000000"],[1554139778499,1554139890802,"17.0000000000000000"],[1554139890802,1554140003105,"17.0000000000000000"],[155414000 … [Строка слишком длинная. Вы можете скачать файл] var datasetSource2 = [[1554076772406,1554077221617,"0.00000000000000000000"],[1554077221617,1554077670828,"0.00000000000000000000"],[1554077670828,1554078120039,"0.00000000000000000000"],[ … [Строка слишком длинная. Вы можете скачать файл] var filterMode = 'weakFilter'; // line-artifact var filterMode = 'empty'; // OK var filterMode = 'filter'; // line-artifact var connectNulls = false; var scale = true; var option = { dataZoom: [ { show: true, realtime: true, filterMode: filterMode, start: 0, end: 100, minValueSpan: 112303 } ], xAxis: { type: "time", min: 1554139674662, max: 1554355295491, }, dataset: [ { source: datasetSource1, sourceHeader: false } ], yAxis: [ { scale: scale, type: "value" } ], series: [ { connectNulls: connectNulls, name: "DSET", type: "line", yAxisIndex: 0, showSymbol: false, symbol: "rect", datasetIndex: 0, encode: { x: [0], y: 2 } } ] }; var option2 = { dataZoom: [ { show: true, realtime: true, filterMode: filterMode, start: 0, end: 100, minValueSpan: 449211 } ], xAxis: { type: "time", min: 1553695124932, max: 1554557608248, }, dataset: [ { source: datasetSource2, sourceHeader: false } ], yAxis: [ { scale: scale, type: "value" } ], series: [ { connectNulls: connectNulls, name: "DSET", type: "line", yAxisIndex: 0, showSymbol: false, symbol: "rect", datasetIndex: 0, encode: { x: [0], y: 2 } } ] }; chart = myChart = testHelper.create(echarts, 'main1', { title: [ 'Case from https://github.com/apache/echarts/issues/10228' ], option: option, button: { text: 'Click to trigger extraneous lines bug', onClick: () => { myChart.setOption(option2, true); } } }); }); </script> <script> require([ 'echarts' ], function (echarts) { var chart; var myChart; const option1 = { xAxis: { type: "time", axisLabel: {}, }, yAxis: { axisLabel: {}, }, dataset: [ { dimensions: ["time", "mean_load15"], source: [ ["2021-09-07T07:53:00Z", 0.215], ["2021-09-07T07:54:00Z", 0.2073684210526316], ["2021-09-07T07:55:00Z", 0.20450000000000004], ], }, ], series: [ { type: "line", name: "mean_load15", encode: { x: "time", y: "mean_load15", }, datasetIndex: 0, smooth: true, lineStyle: { width: 1, }, itemStyle: {}, showSymbol: false, }, ], }; const option2 = { xAxis: { type: "time", axisLabel: {}, }, yAxis: { axisLabel: {}, }, dataset: [ { dimensions: ["time", "mean_load15"], source: [ ["2021-09-02T09:52:00Z", 0.197453237410072], ["2021-09-02T11:33:00Z", 0.10109900990098977], ["2021-09-02T13:14:00Z", 0.13159405940594063], ["2021-09-02T14:55:00Z", 0.11086633663366334], ["2021-09-02T16:36:00Z", 0.1571930693069309], ["2021-09-02T18:17:00Z", 0.14914356435643553], ], }, ], series: [ { type: "line", name: "mean_load15", encode: { x: "time", y: "mean_load15", }, datasetIndex: 0, smooth: true, itemStyle: {}, showSymbol: false, }, ], }; chart = myChart = testHelper.create(echarts, 'main2', { title: [ 'Case from https://github.com/apache/echarts/issues/15685' ], option: option2, button: { text: 'Update twice', onClick: () => { myChart.setOption(option1, true); setTimeout(() => { myChart.setOption(option2, true); }, 50) } } }); }); </script> </body> </html>