/
githubmirror
/
echarts
Обзор
Документация
Войти
/
githubmirror
/
echarts
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/tooltip-lag-glitch.html
143 строки
5 KB
plainheart
fix(tooltip): only throttle `updatePosition` function when transition is enabled, resolves #16101.
12 дек 2021, 02:40
12 дек 2021, 02:40
e546f19
Код
Авторство
О чём код?
<!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> require([ 'echarts' ], function (echarts) { var xdata = []; var i = 0; while (i++ < 100) { xdata.push(i); } function randomData() { var data = []; var i = 0; while (i++ < 100) { // data.push(i + 100 + Math.random() * 50); data.push(i + 100); } return data; } var option = { tooltip: { trigger: "axis" }, xAxis: { type: "category", boundaryGap: false, data: xdata }, yAxis: { type: "value" }, series: [ { showSymbol: false, name: "A", type: "line", data: randomData(), smooth: true, lineStyle: { width: 2 }, emphasis: { lineStyle: { width: 2 } } } ] }; var chart1 = testHelper.create(echarts, 'main0', { title: [ 'Tooltip shouldn\'t shake or be laggy', '1) Chrome with the devtools open', '2) Firefox' ], option: option }); var chart2 = testHelper.create(echarts, 'main1', { title: [ 'Tooltip shouldn\'t shake or be laggy', '1) Chrome with the devtools open', '2) Firefox' ], option: option }); var chart3 = testHelper.create(echarts, 'main2', { title: [ 'Tooltip shouldn\'t be laggy when transition is disabled', 'https://github.com/apache/echarts/issues/16101' ], option: option, buttons: [{ text: 'Disable transition', onclick: function () { var enabled = chart3._transitionEnabled; chart3.setOption({ tooltip: { transitionDuration: enabled && .4 } }); chart3._transitionEnabled = !enabled; this.innerText = (enabled ? 'Disable' : 'Enable') + ' transition'; } }] }); echarts.connect([chart1, chart2]); }); </script> </body> </html>