You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/06/14 21:38:09 UTC
[GitHub] dan5000 commented on issue #4990: Question: Dynamically change data
existing data on Zoom event
dan5000 commented on issue #4990: Question: Dynamically change data existing data on Zoom event
URL: https://github.com/apache/incubator-echarts/issues/4990#issuecomment-397446582
Another way to do it is using the current chart instance` xAxis[0].rangeStart/rangeEnd`
Then filter the original data array against the xAxis times. This only works for timeseries, just thought someone might find it useful. Here's an example:
```
//
const DATA = [[1319846400000, 0.0911189678976507], [1319932800000, 0.088428855674535],…]
onDataZoom(zoom, chart) {
const option = chart.getOption()
const start = option.xAxis[0].rangeStart
const end = option.xAxis[0].rangeEnd
const cropped = DATA.filter(r => r[0] > start && r[0] < end)
const rezipped = this.loess(cropped)
option.series[10].data = rezipped
chart.setOption(option)
}```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org