Skip to content

Rangeslider does not draw chart when using subplots and scattergl #6231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stereokai opened this issue Jun 15, 2022 · 9 comments
Closed

Rangeslider does not draw chart when using subplots and scattergl #6231

stereokai opened this issue Jun 15, 2022 · 9 comments

Comments

@stereokai
Copy link

Please see: http://www.stereokai.com/multi-charts-comparison/#plotly
The code can be found here: https://github.com/stereokai/multi-charts-comparison/blob/publish/renderers/Plotly/Plotly.js#L22-77

Problem: Range slider is empty, does not draw any chart when rendering with webgl.

Expectation: Range slider will draw the data of 1 subplot.

What I found out: Range slider will draw all of the subplots if I change their type to scatter instead of scattergl.

PS. This is my first time using plotly.js, and I have to say, the API is great, and despite struggling with the documentation, this implementation took me relatively little time compared to all other charting libraries I tried!

@alexcjohnson
Copy link
Collaborator

Thanks @stereokai - somehow I thought we already had an open issue for this but I can't find it (@archmoj am I missing it?) anyway you're right that we never completed rangesliders for scattergl. For your use case you'd also be bothered by #2172 and #2010 - which are pretty old issues so as you can deduce rangeslider improvements have not been a top priority for us recently. PRs encouraged of course :)

@stereokai
Copy link
Author

@alexcjohnson I'll try to squeeze in some time for PRs, if you can give me pointers on where to start and what to look for :)

@alexcjohnson
Copy link
Collaborator

Excellent :)

Rangesliders live here: https://github.com/plotly/plotly.js/tree/master/src/components/rangeslider

To actually render the data they call out to the cartesian (2D) plotting code basically pretending to be another regular cartesian subplot:

Cartesian.rangePlot(gd, plotinfo, filterRangePlotCalcData(calcData, id));

For this issue, the challenge is that gl2d traces (such as scattergl) use a separate drawing pathway from the SVG - entrypoint here - that needs to be worked into the above flow. (And note that "calcdata", that the SVG plots use as an intermediate representation between the trace and the drawn objects, is not used by our webgl trace types)

Hope that helps! Feel free to ask more questions as you get into it.

@stereokai
Copy link
Author

And note that "calcdata", that the SVG plots use as an intermediate representation between the trace and the drawn objects, is not used by our webgl trace types

  1. And does rangePlot() require this calcData to work?
  2. If yes, does it mean it is necessary to construct an object with a matching signature based on the gl2d chart data?
  3. Is rangePlot() the method that is used to render regular scattergl charts?

@alexcjohnson
Copy link
Collaborator

rangePlot is a little utility that just strings together a couple of pieces deeper in the SVG drawing path, needed to correctly draw these traces into the rangeslider subplot. I think rather than fitting the gl2d traces into Cartesian.rangePlot, we probably should create a similar routine on the gl2d side - that runs after Cartesian.rangePlot so it can depend on the framework already being present - but just adds the gl2d pieces.

Another thing to note: we support partial bundles, some of which don't include gl2d traces, so we'll want to find this code not via normal require statements but via perhaps Registry.getModule so we can skip this part if that module isn't found.

@stereokai
Copy link
Author

I see. If Cartesian.rangePlot is only SVG then how would a prospective gl2d method run after it? Would Cartesian.rangePlot still be part of the process?

@alexcjohnson
Copy link
Collaborator

I suspect that Cartesian.rangePlot may still need to be run just to get the framework set up correctly, even if there are no SVG traces to draw. But I'm not 100% sure about that, it may be OK to skip it if you have only gl2d traces.

@stereokai
Copy link
Author

Okay. I understand though only theoretically as I haven't looked at the code yet.

Any chance you might have a moment to chime in on the conversation here? (Particularly to my reply to you)

Thanks one more time

@gvwilson
Copy link
Contributor

gvwilson commented Jul 3, 2024

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

@gvwilson gvwilson closed this as completed Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants