I have a chart of financial data, e.g. prices of a stock, using the great echarts.js library.
I wish the user will be able to select a portion of this chart with the mouse, by clicking and dragging. The selected range isn't needed to zoom the chart, but only tell the user some information, e.g. max price, minimum price in the selection.
I think I can accomplish this using brush and brushType:'lineX'
.
My concern is now regarding the toolbox. I don't want it.
I can hide it, by setting show:false
, but without toolbox buttons I cannot select the 'lineX' brush.
Is it possible to activate programmatically the 'lineX' brush? I wish that the chart will always have this brush active, and that the user can reset the brush selected range, just by clicking. Without deactivating the 'lineX' selection. Is this possible?
Try below:
myChart.dispatchAction({
type: 'takeGlobalCursor',
key: 'brush',
brushOption: {
brushType: 'lineX',
brushMode: 'single'
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With