/
githubmirror
/
echarts
Обзор
Документация
Войти
/
githubmirror
/
echarts
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
5.3.3
test/line-case.html
615 строк
23 KB
pissang
fix(line): fix endLabel have error when series is filtered.
07 янв 2022, 09:20
07 янв 2022, 09:20
639d78e
Код
Авторство
О чём код?
<!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"></div> <div id="main1"></div> <div id="main2"></div> <div id="main3"></div> <script> require([ 'echarts' ], function (echarts) { var option = { backgroundColor: '#fff', animation: false, color: ["#6e2ebf", "#9a2ead", "#87d812", "#20c05b", "#19c6f4", "#0072df"], grid: { left: '10', right: '10', bottom: '20', containLabel: true }, xAxis: [{ type: 'time', boundaryGap: false }], yAxis: [{ type: 'value', splitLine: { show: false }, max: function(value) { return 100; } }], series: [{ id: 'other', name: 'Other', type: 'line', stack: '1', smooth: 0.2, lineStyle: { width: 1 }, showSymbol: false, areaStyle: {}, data: [ [1626560700000, 10.7], [1626561600000, 10.6], [1626562500000, 11.1], [1626563400000, 14.2], [1626564300000, 12.2], [1626565200000, 11.7], [1626566100000, 12.6], [1626567000000, 13.4], [1626567900000, 14.3], [1626568800000, 10.8], [1626569700000, 13.3], [1626570600000, 11.8], [1626571500000, 12.5], [1626572400000, 14.4], [1626573300000, 15.8], [1626574200000, 10.7], [1626575100000, 11.9], [1626576000000, 12.7], [1626576900000, 14.0], [1626577800000, 12.6], [1626578700000, 11.0], [1626579600000, 10.8], [1626580500000, 14.0], [1626581400000, 12.6], [1626582300000, 12.3], [1626583200000, 10.6], [1626584100000, 12.3], [1626585000000, 13.6], [1626585900000, 11.7], [1626586800000, 11.1], [1626587700000, 13.1], [1626588600000, 11.6], [1626589500000, 12.1], [1626590400000, 12.2], [1626591300000, 12.3], [1626592200000, 13.5], [1626593100000, 23.4], [1626594000000, 19.2], [1626594900000, 21.8], [1626595800000, 11.3], [1626596700000, 13.2], [1626597600000, 14.7], [1626598500000, 12.5], [1626599400000, 12.0], [1626600300000, 12.9], [1626601200000, 13.7], [1626602100000, 12.1], [1626603000000, 12.2], [1626603900000, 14.0], [1626604800000, 11.8], [1626605700000, 14.5], [1626606600000, 12.4], [1626607500000, 13.0], [1626608400000, 12.3], [1626609300000, 14.3], [1626610200000, 13.4], [1626611100000, 13.2], [1626612000000, 12.1], [1626612900000, 11.7], [1626613800000, 12.2], [1626614700000, 12.0], [1626615600000, 10.9], [1626616500000, 13.0], [1626617400000, 11.6], [1626618300000, 13.1], [1626619200000, 10.9], [1626620100000, 10.9], [1626621000000, 10.8], [1626621900000, 12.6], [1626622800000, 12.8], [1626623700000, 9.9], [1626624600000, 18.7], [1626625500000, 12.9], [1626626400000, 12.9], [1626627300000, 12.0], [1626628200000, 10.8], [1626629100000, 12.7], [1626630000000, 9.9], [1626630900000, 21.6], [1626631800000, 19.8], [1626632700000, 12.4], [1626633600000, 11.9], [1626634500000, 19.6], [1626635400000, 16.0], [1626636300000, 11.9], [1626637200000, 10.9], [1626638100000, 13.7], [1626639000000, 15.4], [1626639900000, 11.8], [1626640800000, 11.6], [1626641700000, 12.6], [1626642600000, 13.3], [1626643500000, 13.9], [1626644400000, 10.9], [1626645300000, 38.6], [1626646200000, 10.4] ] }, { id: 'system', name: 'System', type: 'line', stack: '1', smooth: 0.2, lineStyle: { width: 1 }, showSymbol: false, areaStyle: {}, data: [] }, { id: 'ags', name: 'A Server', type: 'line', stack: '1', smooth: 0.2, lineStyle: { width: 1 }, showSymbol: false, areaStyle: {}, data: [ [1626560700000, 14.3], [1626561600000, 3.1], [1626562500000, 4.4], [1626563400000, 5.4], [1626564300000, 7.7], [1626565200000, 3.6], [1626566100000, 7.5], [1626567000000, 5.5], [1626567900000, 11.9], [1626568800000, 3.9], [1626569700000, 8.9], [1626570600000, 7.8], [1626571500000, 5.9], [1626572400000, 4.6], [1626573300000, 8.4], [1626574200000, 5.4], [1626575100000, 12.0], [1626576000000, 4.2], [1626576900000, 7.4], [1626577800000, 5.8], [1626578700000, 8.8], [1626579600000, 3.1], [1626580500000, 5.7], [1626581400000, 6.1], [1626582300000, 13.9], [1626583200000, 3.1], [1626584100000, 5.9], [1626585000000, 5.9], [1626585900000, 7.5], [1626586800000, 3.4], [1626587700000, 5.7], [1626588600000, 6.0], [1626589500000, 9.1], [1626590400000, 3.2], [1626591300000, 7.1], [1626592200000, 5.4], [1626593100000, 5.9], [1626594000000, 3.3], [1626594900000, 7.2], [1626595800000, 8.2], [1626596700000, 11.6], [1626597600000, 3.2], [1626598500000, 6.9], [1626599400000, 7.9], [1626600300000, 5.2], [1626601200000, 3.5], [1626602100000, 6.9], [1626603000000, 5.9], [1626603900000, 4.6], [1626604800000, 10.4], [1626605700000, 5.9], [1626606600000, 6.4], [1626607500000, 4.4], [1626608400000, 5.1], [1626609300000, 5.4], [1626610200000, 5.0], [1626611100000, 5.3], [1626612000000, 9.2], [1626612900000, 7.4], [1626613800000, 4.8], [1626614700000, 5.8], [1626615600000, 4.9], [1626616500000, 7.5], [1626617400000, 5.1], [1626618300000, 7.5], [1626619200000, 12.2], [1626620100000, 8.4], [1626621000000, 5.0], [1626621900000, 7.3], [1626622800000, 3.3], [1626623700000, 7.5], [1626624600000, 5.0], [1626625500000, 8.4], [1626626400000, 12.2], [1626627300000, 7.7], [1626628200000, 4.9], [1626629100000, 7.1], [1626630000000, 3.5], [1626630900000, 5.6], [1626631800000, 4.6], [1626632700000, 7.1], [1626633600000, 12.6], [1626634500000, 5.2], [1626635400000, 5.1], [1626636300000, 7.5], [1626637200000, 3.0], [1626638100000, 5.9], [1626639000000, 5.2], [1626639900000, 6.7], [1626640800000, 15.1], [1626641700000, 5.5], [1626642600000, 5.1], [1626643500000, 6.6], [1626644400000, 2.9], [1626645300000, 34.5], [1626646200000, 5.7] ] }, { id: 'ptl', name: 'Z Server', type: 'line', stack: '1', smooth: 0.2, lineStyle: { width: 1 }, showSymbol: false, areaStyle: {}, data: [] }, { id: 'ads', name: 'B Server', type: 'line', stack: '1', smooth: 0.2, lineStyle: { width: 1 }, showSymbol: false, areaStyle: {}, data: [] }, { id: 'web', name: 'C Server', type: 'line', stack: '1', smooth: 0.2, lineStyle: { width: 1 }, showSymbol: false, areaStyle: {}, data: [ [1626560700000, 0.1], [1626561600000, 0.0], [1626562500000, 0.1], [1626563400000, 0.1], [1626564300000, 0.1], [1626565200000, 0.1], [1626566100000, 0.0], [1626567000000, 0.1], [1626567900000, 0.1], [1626568800000, 0.0], [1626569700000, 0.0], [1626570600000, 0.1], [1626571500000, 0.1], [1626572400000, 0.0], [1626573300000, 0.0], [1626574200000, 0.4], [1626575100000, 0.1], [1626576000000, 0.0], [1626576900000, 0.1], [1626577800000, 0.1], [1626578700000, 0.2], [1626579600000, 0.0], [1626580500000, 0.1], [1626581400000, 0.1], [1626582300000, 0.1], [1626583200000, 0.0], [1626584100000, 0.0], [1626585000000, 0.1], [1626585900000, 0.2], [1626586800000, 0.2], [1626587700000, 0.0], [1626588600000, 0.0], [1626589500000, 0.1], [1626590400000, 0.0], [1626591300000, 0.1], [1626592200000, 0.0], [1626593100000, 0.1], [1626594000000, 0.0], [1626594900000, 0.1], [1626595800000, 0.1], [1626596700000, 0.3], [1626597600000, 0.0], [1626598500000, 0.1], [1626599400000, 0.1], [1626600300000, 0.2], [1626601200000, 0.0], [1626602100000, 0.1], [1626603000000, 0.0], [1626603900000, 0.2], [1626604800000, 0.1], [1626605700000, 0.1], [1626606600000, 0.1], [1626607500000, 0.2], [1626608400000, 0.1], [1626609300000, 0.1], [1626610200000, 0.1], [1626611100000, 0.2], [1626612000000, 0.0], [1626612900000, 0.1], [1626613800000, 0.0], [1626614700000, 0.2], [1626615600000, 0.1], [1626616500000, 0.1], [1626617400000, 0.0], [1626618300000, 0.1], [1626619200000, 0.0], [1626620100000, 0.0], [1626621000000, 0.0], [1626621900000, 0.1], [1626622800000, 0.0], [1626623700000, 0.1], [1626624600000, 0.1], [1626625500000, 0.2], [1626626400000, 0.1], [1626627300000, 0.1], [1626628200000, 0.1], [1626629100000, 0.2], [1626630000000, 0.0], [1626630900000, 0.0], [1626631800000, 0.1], [1626632700000, 0.1], [1626633600000, 0.0], [1626634500000, 0.1], [1626635400000, 0.1], [1626636300000, 0.2], [1626637200000, 0.0], [1626638100000, 0.0], [1626639000000, 0.1], [1626639900000, 0.1], [1626640800000, 0.0], [1626641700000, 0.1], [1626642600000, 0.1], [1626643500000, 0.1], [1626644400000, 0.1], [1626645300000, 0.1], [1626646200000, 0.1] ] }] }; var chart = testHelper.create(echarts, 'main0', { title: [ 'Test case from https://github.com/apache/echarts/issues/15380' ], option: option }); }); </script> <script> require([ 'echarts', 'ecStat' ], function (echarts, ecStat) { var data = [ [1, 5], [4, 10], [4,5], [6, 5] ]; echarts.registerTransform(ecStat.transform.regression); var option = { dataset: [{ source: data }, { transform: { type: 'ecStat:regression', config: { method: 'polynomial', order: 3 } } }], tooltip: { trigger: 'axis', axisPointer: { type: 'cross' } }, xAxis: {}, yAxis: {}, series: [{ name: 'scatter', type: 'scatter' }, { name: 'line', type: 'line', datasetIndex: 1, symbolSize: 0.1, symbol: 'circle', label: { show: true, fontSize: 16 }, smooth: true, labelLayout: { dx: -20 }, encode: { label: 2, tooltip: 1 } }] }; var chart = testHelper.create(echarts, 'main1', { title: [ 'Polyline with smooth should been displayed', 'Test case from https://github.com/apache/echarts/issues/15371' ], option: option }); }); </script> <script> require([ 'echarts' ], function (echarts) { var data = [ [0, 0], [10, 10], [10, 10], [20, 0] ]; var option = { xAxis: { type: 'value' }, yAxis: {}, series: [{ name: 'line', type: 'line', data, smooth: true }] }; var chart = testHelper.create(echarts, 'main2', { title: [ 'Smoothed polyline should been displayed when having duplicat points.' ], option: option }); }); </script> <script> require([ 'echarts' ], function (echarts) { option = { toolbox: { top: 10, left: 'center', show: true, orient: 'horizontal', showTitle: true, feature: { saveAsImage: { type: 'png', backgroundColor: 'pink', name: 'hwbtest', title: '保存' }, restore: {}, dataView: {}, dataZoom: {} } }, grid: { left: '10%', right: '15%', bottom: '15%', }, xAxis: { type: 'category', boundaryGap: false, data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] }, yAxis: { type: 'value' }, series: [ { name: '邮件营销', type: 'line', data: [110, 132, 101, 134, 90, 230, 210], endLabel: { show:true, formatter: '{a}: {b}' } }, { name: '销量', type: 'line', data: [210, 232, 201,234, 290, 240, 230], endLabel: { show:true, formatter: '{a}: {b}' } } ] }; var chart = testHelper.create(echarts, 'main3', { title: [ 'Should have no error when dataZoom on one points.', 'Case from https://github.com/apache/echarts/issues/16094' ], option: option }); }); </script> </body> </html>