plotly / plotly/plotly.js

No error thrown if invalid type provided, silently falls back to `scatter`

Open
#4,813 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

If you enter a type for a trace that is not supported in the package you have, Plotly simply falls back to scatter plot. This is incorrect, an error should be thrown to indicate the user entered an invalid type.

In my particular case, I had been using scattergl type with the full plotly.js-dist bundle, then when I switched our project over to plotly.js-finance (https://github.com/plotly/plotly.js/blob/master/dist/README.md#plotlyjs-finance) I thought everything was working correctly as all our test charts appeared correctly. However, I didn't notice plotly.js-finance did not include scattergl, so was in fact falling back to scatter, which had a significant performance penalty I did not notice while testing. I would have much appreciated an error indicating the type I was providing was not available in the partial bundle I was using.

I've made a code pen of the issue here, using a type "aninvalidtype": https://codepen.io/mofojed/pen/pojpVvP

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodePen reproduction using "aninvalidtype" and compare behavior between the full plotly.js-dist bundle and plotly.js-finance, especially for the unavailable scattergl type. Trace how the selected trace type is resolved in the package entry points. Done means unsupported types produce an error instead of silently rendering as scatter, with regression coverage for partial bundles.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.