✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar!

Rangeselector changing default to something else

Hi,

I have a couple options for rangeselector buttons including 6 months, 1 year and all. The choice “all” is set to default. Is there any way to make the default “6 months” instead of “all”?

Thanks

Changing the xaxis.range should do the trick.

I see. Could you give me an example?
This is what I’m currently doing,
var x_axis_format = {
title: ‘Date’,
titlefont,
autorange: true,
range: [‘2014-01-01’, current_date],
rangeselector: { buttons: [
{
count: 6,
label: ‘6 Months’,
step: ‘month’,
stepmode: ‘backward’
},
{
count: 1,
label: ‘1 Year’,
step: ‘year’,
stepmode: ‘backward’
},
{
label: “All”,
step: ‘all’
}

                    ] },
                    rangeslider: {range:['2014-01-01', current_date]},
                    type: 'date'
                }