简体   繁体   English

Apache ECharts - 刷有折线图范围选择

[英]Apache ECharts - Brush with line chart range selection

Setting up a line chart with line series and a horizontal selection brush ( lineX ) doesn't seem to provide a way of reading the selected range values.使用line系列和水平选择画笔 ( lineX ) 设置折线图似乎无法提供读取所选范围值的方法。 Changing the series type to bar or scatter seems to work as expected.将系列类型更改为barscatter似乎可以按预期工作。 I'm wondering if this is a bug or if more configurations are required.我想知道这是一个错误还是需要更多配置。

 var container = document.getElementById('main'); var chart = echarts.init(container); chart.setOption({ xAxis: { data: [3, 4, 5] }, yAxis: { }, brush: { toolbox: ['lineX'], type: 'lineX', }, series: [{ type: 'line', // changing this to scatter or other types makes the brush selection work data: [120, 200, 150] }] }); chart.on('brushSelected', function(params){ // this shows an empty array - while it should be the range selected console.log(params.batch[0].selected[0].dataIndex) });
 #main { width: 600px; height: 400px; border: 1px solid red; }
 <html> <body> <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.0.2/echarts.min.js"></script> <div id="main"></div> </body> </html>

Currently, supported brush types include: scatter, bar, candlestick.目前,支持的画笔类型包括:散点图、条形图、烛形图。 (Note that parallel contains brush function by itself, which is not provided by brush component.) (注意parallel自带刷子function,刷子组件不提供。)

https://echarts.apache.org/en/option.html#brush https://echarts.apache.org/en/option.html#brush

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM