Closed pruharikantamipara closed 3 years ago
Hello @pruharikantamipara, you can achieve that by setting extremes after your chart is finished loading, eg.
chart.events = HIEvents()
chart.events.load = HIFunction(jsFunction: "function () { this.xAxis[0].setExtremes(min, max); }")
Just replace min
and max
with proper values.
thank you for the help me. i have set above code and working fine. but is there any way to set zoom level without getting min max value from console?
@pruharikantamipara you can use any values you need. Please check API of setExtremes
method.
can you please provide me the demo code for setExtremes
.
@pruharikantamipara sure.
chart.events.load = HIFunction(jsFunction: "function () { this.xAxis[0].setExtremes(0, 5); }")
and on HIXaxis
or HIYAxis
object:
let xAxis = chart.options.xAxis.first!
xAxis.setExtremes()
xAxis.setExtremes(0)
xAxis.setExtremes(0, newMax: 5)
xAxis.setExtremes(0, newMax: 5, redraw: false)
let animation = HIAnimationOptionsObject()
animation.duration = 0
xAxis.setExtremes(0, newMax: 5, redraw: false, animation: animation)
Hello @ihnatmoisieiev
i have tired last solution xAxis.setExtremes(min, max: 5, redraw: false)
but isn't work well.
so i try with this code chart.events.load = HIFunction(jsFunction: "function () { this.xAxis[0].setExtremes(min, max); }")
and its working fine.
@pruharikantamipara when you need to get it on init, use chart.events.load = HIFunction(jsFunction: "function () { this.xAxis[0].setExtremes(min, max); }")
.
Hello @ihnatmoisieiev my query resolved. i do not have any query now. thank you.
Hello i need to set zoom in default when my chart is initially loading. i have attached screenshot for better understanding. one screenshot is default chart loading & second is zoom in using pinch zoom. so i required same zoom in level without pinch zoom.