Home Forums StockChart Support How to change Navigation range accordingly to range selection Reply To: How to change Navigation range accordingly to range selection

#38328

First of all, thanks for your reply, i managed to get the navigation bar resizing when selecting different range buttons.
Unfortunatelly this has introduced some bad behaviour that i had not before these changes, i’ll list below:

– before the modification you suggested, when the chart was rendered the first time i set the rangeSelector property “selectedRangeButtonIndex: 2” so the button with index 2 was selected. But now, setting this button using that property, the event “rangeChanged” is not triggered. Should i force this event via code so when the chart is loaded with button index 2 selected the navigation bar is set accordingly or there’s another way to do this?

– when selecting a different button, inside the rangeChanged(e) function i set these 2 properties:

// my intention was to set the new button as the selected one
stockChart.rangeSelector.selectedRangeButtonIndex = e.index;

// and change the color of the new button
stockChart.rangeSelector.buttonStyle.set(“backgroundColorOnSelect”, “#ff9800”);

My intention is to remove custom color from the “old” button and assign to the new selected. With the 2 commands above the new button is colored with my custom color, but as soon as i move the mouse, the color is reverted to white

– In order to see again ALL the chart data i need to click TWICE the “ALL” button in range selector, and this happen also in your JDIfiddle example above. Try selecting, the first time the page is loadedm range 3 months and then the ALL button. You’ll see that the first time will change just the navigation bar, and with a second click also the chart data will change accordingly.

thanks, your help is much appreciated