Friday, 9 September 2022

In plotly, is it possible to have an action where a user clicks and sees a different time range in the chart?

I'm creating a plotly python chart for a web app. Right now I am using the 'rangeselector' option to display different views to go back 7 days, 14 days, etc. However - what I actually want is a way to show the data for "this week", "last week", "the week before last week", etc. For the range selector, it always seems to start backward from today. Is there a way to do this in plotly? If not, is there a different way to go about this (i.e., a different charting library, some javascript)?

I'm new to web development, so thank you for the help.

rangeselector=dict(
        buttons=list([
            dict(count=7,
                    label="7d",
                    step="day",
                    stepmode="backward"),
            dict(count=14,
                    label="14d",
                    step="day",
                    stepmode="backward"),
            dict(count=1,
                    label="1m",
                    step="month",
                    stepmode="backward"),
            dict(count=6,
                    label="6m",
                    step="month",
                    stepmode="backward"),
            dict(count=1,
                    label="YTD",
                    step="year",
                    stepmode="todate"),
            dict(step="all")
        ])
    ),


from In plotly, is it possible to have an action where a user clicks and sees a different time range in the chart?

No comments:

Post a Comment