/
githubmirror
/
echarts
Обзор
Документация
Войти
/
githubmirror
/
echarts
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/bar-stream-large1.html
207 строк
7 KB
100pah
fix: Fix issues in regression test.
29 мар 2026, 12:16
29 мар 2026, 12:16
b81fa44
Код
Авторство
О чём код?
<!-- 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="lib/frameInsight.js"></script> --> <link rel="stylesheet" href="lib/reset.css" /> </head> <body> <style> .test-title { background: #146402; color: #fff; } #snapshot { width: 150; height: 100; background: #fff; border: 5px solid rgba(0,0,0,0.5); } </style> <div id="main0"></div> <img id="snapshot"/> <div id="duration"></div> <script> function ValueGenerator(baseValue) { this._baseValue = baseValue; } ValueGenerator.prototype.next = function () { var value = this._baseValue += Math.random() * 20 - 10; return Math.max(500, Math.round(value) + 3000); } require([ 'echarts' ], function (echarts) { // frameInsight.init(echarts, 'duration'); var _ctx = { count: { value: 1e5, values: [1e5, 5e5, 1e6, 5e6], }, progressiveChunkMode: { value: 'NOT_SET', values: ['NOT_SET', 'sequential', 'mod'], } }; function createOption() { var xAxisData = []; var data1 = []; var data2 = []; var generator1 = new ValueGenerator(Math.random() * 1000); // var generator2 = new ValueGenerator(Math.random() * 5000); var count = _ctx.count.value; for (var i = 0; i < count; i++) { xAxisData.push('category' + i); data1.push(generator1.next().toFixed(2)); // data2.push(generator2.next().toFixed(2)); } var option = { title: { text: echarts.format.addCommas(count) + ' Bars', left: 10 }, legend: { top: 5, data: ['bar', 'bar2', 'bar3', 'bar4'], align: 'left' }, toolbox: { // y: 'bottom', feature: { magicType: { type: ['line', 'bar', 'stack', 'tiled'] }, dataZoom: { yAxisIndex: false }, dataView: {}, saveAsImage: { pixelRatio: 2 } } }, tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, dataZoom: [{ type: 'inside' }, { type: 'slider' }], xAxis: { data: xAxisData, silent: false, splitLine: { show: false }, splitArea: { show: false } }, yAxis: { splitArea: { show: false } }, series: [{ name: 'bar', type: 'bar', // stack: 'one', data: data1, progressiveThreshold: 1e2, largeThreshold: 1e2, itemStyle: { color: 'rgba(100,100,0,0.4)' // borderColor: 'yellow' }, large: true // progressiveChunkMode: 'sequential' // }, { // show: false, // name: 'bar2', // type: 'bar', // stack: 'one', // data: data[1] }] }; if (_ctx.progressiveChunkMode.value !== 'NOT_SET') { option.series[0].progressiveChunkMode = _ctx.progressiveChunkMode.value; } return option; } function updateChart() { chart.setOption(createOption(), {notMerge: true}); } var chart = testHelper.create(echarts, 'main0', { title: [ '(1) Check legend click', '(2) Check `progressiveChunkMode: "mod"` render correct', '(3) Check snapshot rendering when "finished"' ], option: createOption(), inputsStyle: 'compact', inputs: testHelper.createInputsSimply(_ctx, updateChart), }); if (chart) { var renderSnapShot = echarts.throttle(function () { console.log('chart.on("finished", echarts.throttle(fn, 500, true))'); var url = chart.getDataURL(); var snapshotEl = document.getElementById('snapshot'); snapshotEl.src = url; }, 500, true); chart.on('finished', renderSnapShot); } }); </script> </body> </html>