/
githubmirror
/
echarts
Обзор
Документация
Войти
/
githubmirror
/
echarts
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/line.html
253 строки
9 KB
pissang
test(visual): fix cases that using async loading
08 май 2021, 17:12
08 май 2021, 17:12
f0e96fe
Код
Авторство
О чём код?
<!-- 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> </head> <body> <style> html, body, #main { width: 100%; height: 100%; } </style> <div id="info"></div> (1) tick 14 and 20 should be red (has textStyle) <br> (2) Check all symbol show if possible<br> (3) Toggle the legend line4, the image symbol, emphasis style and normal style are normal <div id="main"></div> <script> require(['echarts'], function (echarts) { var chart = echarts.init(document.getElementById('main')); var xAxisData = []; var data1 = []; var data2 = []; var data3 = []; var data4 = []; for (var i = 0; i < 100; i++) { if (i === 14 || i === 20) { xAxisData.push({ value: '类目' + i, textStyle: { color: 'red' } }); } else { xAxisData.push('类目' + i); } if (i < 5 && i > 1) { data1.push(0); } else { data1.push(+(Math.random() + 0.5).toFixed(3)); } data2.push(+(Math.random() + 0.5).toFixed(3)); data3.push(+(Math.random() + 0.5).toFixed(3)); data4.push(+(Math.random() + 0.5).toFixed(3)); } var itemStyle = { normal: { borderColor: 'white', borderWidth: 3, // shadowBlur: 10, // shadowOffsetX: 0, // shadowOffsetY: 5, // shadowColor: 'rgba(0, 0, 0, 0.4)', lineStyle: { width: 1 // shadowBlur: 10, // shadowOffsetX: 0, // shadowOffsetY: 5, // shadowColor: 'rgba(0, 0, 0, 0.4)' } } }; chart.setOption({ // title: { // text: '折线图{a|asdf}Step line', // subtext: 'subtitle', // backgroundColor: '#ee99aa', // borderRadius: 5, // padding: 10, // textStyle: { // rich: { // a: { // color: '#338844', // fontSize: 30, // borderColor: '#119955', // borderWidth: 3, // backgroundColor: '#445566' // } // } // } // }, legend: { data: ['line', 'line2', 'line3', 'line4'] }, visualMap: null, // 用于测试 option 中含有null的情况。 tooltip: { trigger: 'axis', axisPointer: { type: 'line' } }, xAxis: { // data: ['类目1', '类目2', '类目3', '类目4', '类目5',] data: xAxisData, boundaryGap: false, // inverse: true, splitArea: { show: false }, splitLine: { show: false }, axisLabel: { // showMaxLabel: true, // showMinLabel: true } }, grid: { left: '10%', right: '10%' }, yAxis: { axisLabel: { textStyle: { color: 'red' } }, splitArea: { show: true } }, dataZoom: [{ type: 'inside', // start: 10, // end: 30 startValue: 11, endValue: 85 }, { type: 'slider', startValue: 11, endValue: 85 }], // animation: false, series: [null, // 用于测试 option 中含有null的情况。 { name: 'line', type: 'line', stack: 'all', symbol: 'path://M164,210.677v33.47l154.656,66.356L468,243.681v-33.004H164L164,210.677z M164,282.255L164,282.255v134.76h304V282.061l-149.012,66.615L164,282.255L164,282.255z', symbolKeepAspect: true, symbolSize: 40, data: data1, itemStyle: itemStyle, label: { normal: { show: true, fontSize: 12 } }, lineStyle: { normal: { shadowBlur: 4, shadowOffsetX: 3, shadowOffsetY: 3 } }, step: 'end' }, { label: { normal: { show: true, position: 'outside' } }, name: 'line2', type: 'line', stack: 'all', symbol: 'circle', symbolSize: 10, // showAllSymbol: false, data: data2, itemStyle: itemStyle, step: 'end' }, { name: 'line3', type: 'line', stack: 'all', symbol: 'triangle', symbolSize: 10, data: data4, itemStyle: itemStyle, step: 'end' }, { name: 'line4', type: 'line', stack: 'all', symbol: 'image://asset/echarts-logo.png', symbolKeepAspect: true, symbolSize: 40, data: data1, itemStyle: itemStyle, animationDuration: 300, label: { normal: { show: true, fontSize: 12 } }, emphasis: { itemStyle: { shadowColor: 'black', shadowOffsetX: 10 } }, lineStyle: { normal: { shadowBlur: 4, shadowOffsetX: 3, shadowOffsetY: 3 } }, step: 'end' }] }); window.onresize = chart.resize; }) </script> </body> </html>