question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rangeselector is not relative to X-axis data in scatter/lines+marker plots

See original GitHub issue

When drawing a scatter plot with a mode of lines+marker with an xaxis rangeselector enabled, changing ranges results in a range being shown that isn’t relative to the actual data itself.

My example is at https://codepen.io/davidjb/pen/dJYWaV (a fork of the example from https://plot.ly/javascript/range-slider/) – changing between lines and lines+markers down the very bottom shows the difference in behaviour.

With a mode of lines, a plot’s X axis ends where the data does, and so choosing 1m, 6m and so in the range selector result in a plot that shows that during from the end of the dataset. In lines+markers, however, choosing a range is relative to the end of the original plot, resulting in an empty or partially empty plot because the range will extend past the end of the dataset. Depending on how spread out your data is, this could result in a fully empty plot (like the example, where it shows a range in 2019 for a dataset in 2016) or a partially visible trace on the left-hand side.

My expectation was that the rangeselector would always operate relative to the data – so in this case being the same behaviour between lines and lines+marker.

Seems related to #928, with regards to the ‘padding’ on the far right of the plot. Example tested with plotly.js 1.13.2 (latest at time of writing).

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
alberto-braccicommented, May 30, 2020

Has this been fixed or is there any way around it? I tried fixing the range manually but it does not work with the buttons in “backward” mode. The plot starts zoomed in the correct range, but the count for “1 month backward” starts from 3 months in future w.r.t. to my latest date. Moreover fixing the range just determines a correct zoom, not the maximum range of the data to see

1reaction
ethanoppcommented, Sep 22, 2019

Double click is not the only issue, the axis don’t line up when using range selector buttons either…

…Looking for a python solution myself

Read more comments on GitHub >

github_iconTop Results From Across the Web

xAxis.Categories does not works in highcharts when used ...
I am working on using range-selector with column charts in Highcharts. By default, the data shown on the x-axis is Date/Time there, ...
Read more >
rangeSelector | highstock API Reference
The range selector is a tool for selecting ranges to display within the chart. ... When the rangeselector is floating, the plot area...
Read more >
jqxChart rangeselector and two lines xAxis format
When I use rangeselector option within the chart, if I select a range with range selector and then I change data, even if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found