Skip to content
Advertisement

How to change the initial value Chart.js-RangeSlider? [Solved]

The Chart.js-RangeSlider doesnt starts at the initial value given (1901, 1910) and shows the chart:

What i’m searching is changin the initial value, and get the image below:

[..snip..]

rsLluviaHistorica = new RangeSliderChart({
  chartData: iniDataLluviaHistorica,
  chartOpts: optionsLluviaHistorica,
  chartType: 'line',
  chartCTX: iniLluviaHistorica,
  //class: 'my-chart-ranger',
  initial: [1901, 1910]        
})

//this doesnt work
rsLluviaHistorica.options.initial = [1901, 1910]

The code: https://jsfiddle.net/sckull/hy0p75cq/14/

Advertisement

Answer

Solved

The initial value has to be in range of the length of the data (0 to 112 in my case):

rsLluviaHistorica = new RangeSliderChart({
  chartData: iniDataLluviaHistorica,
  chartOpts: optionsLluviaHistorica,
  chartType: 'line',
  chartCTX: iniLluviaHistorica,

  //range of 0 - 112
  initial: [0, 10]        
})

Solved: https://jsfiddle.net/sckull/hy0p75cq/16/

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement