score:2

Accepted answer

You could place a JavaScript function in chart.events.load option in Highcharter. Using Renderer you could add a button that will use setExtremes function on click.

Demo in JSFiddle (without Highcharter nor `R, data is different, but functionality of the button is the same): http://jsfiddle.net/e69eLm6q/

Code to run in R:

library("quantmod")

usdjpy <- getSymbols("USD/JPY", src = "oanda", auto.assign = FALSE)
eurkpw <- getSymbols("EUR/KPW", src = "oanda", auto.assign = FALSE)

hc <- highchart(type = "stock") %>% 
  hc_title(text = "Charting some Symbols") %>% 
  hc_add_series(data = usdjpy, id = "usdjpy", pointInterval = 36000000) %>% 
  hc_add_series(data = eurkpw, id = "eurkpw", pointInterval = 36000000) %>%
  hc_rangeSelector(buttons=list(list(type='month', text='New', count=2))) %>%
  hc_chart(
    events = list(
        load = JS("function(){
            var chart = this;

            chart.renderer.button('do stuff',200, 100)
                .attr({
                    zIndex: 3
                })
                .on('click', function () {
                    chart.xAxis[0].setExtremes(Date.UTC(1970, 4, 1), Date.UTC(1970, 6, 1));
                })
                .add();
        }")
    )
  )

hc

Related Query

More Query from same tag