Skip to content
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

Ordinal scales crash on mid-sized datasets in Chrome and Firefox #4974

Closed
fedarko opened this issue May 17, 2019 · 3 comments
Closed

Ordinal scales crash on mid-sized datasets in Chrome and Firefox #4974

fedarko opened this issue May 17, 2019 · 3 comments

Comments

@fedarko
Copy link

fedarko commented May 17, 2019

I ran into this problem on a dataset with about 3,000 rows on a single bar plot. I'd been using a quantitative scale, but was looking to switch to using an ordinal scale to ensure that each bar would be assigned at least one pixel of width.

I noticed that the editor would just crash whenever I tried using an ordinal scale with my data. Strangely, this crash was triggered by a certain amount of data rows being present: I was able to isolate it down to exactly 1,631 being the upper limit of data rows that would work. Adding in one more data row would consistently cause the Vega Editor to crash. (I've worked with and seen examples of way larger datasets in Vega-Lite, so I figure this is a bug.)

The dataset that causes this error

This spec is a subset of the data I'm currently working with. It displays fine as it currently is.

When I open that data in the Vega Editor in Chrome, and add in exactly one more
data row to the spec, the entire visualization crashes without an error message
in the same way as with the flights-2k dataset—all I see is this:
Screen Shot 2019-05-17 at 1 25 15 AM
(Changing up the Feature ID and Intercept doesn't seem to make a difference in preventing the crash, also.)

Reproducing the problem with a more "normal" dataset

I know the spec above isn't very minimal (sorry!), so I was able to reproduce this sort of problem using the flights-2k Vega example dataset. The below spec crashes in the Vega Editor and when loaded using Vega-Embed:

{
    "data": {"url": "data/flights-2k.json"},
    "mark": "bar",
    "encoding": {
        "x": {
            "type": "ordinal",
            "field": "date"
        },
        "y": {
            "type": "quantitative",
            "field": "delay"
        }
    },
    "$schema": "https://vega.github.io/schema/vega-lite/v3.json"
}

It's worth noting that this works fine for me in Safari, strangely enough. Chrome (which for me is at version 74.0.3729.157) is where I get a crash.

(I installed Firefox on my computer just to test if this crashes there also, but it looks like every spec I try also crashes in Firefox with the error [Error] [Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: https://vega.github.io/editor/vega.js :: t.a :: line 18" data: no]. That seems like a different problem. I'm using Firefox version 66.0.5, for reference.)

Thanks!

@fedarko
Copy link
Author

fedarko commented May 17, 2019

Update: apparently explicitly stating "scale": {"rangeStep": 1} in the x encoding fixes this. So... problem fixed?

Still, it's kind of strange that this crashes the way it does—per the docs here, I was expecting an unspecified rangeStep to be valid. (Even if it's required, I think it'd be nice to notify the user what's wrong with their input.)

@domoritz
Copy link
Member

The problem is the size of the canvas, I think. If you use SVG, the chart should render. As far as I understand it, it's a browser limitation.

@fedarko
Copy link
Author

fedarko commented May 18, 2019

Understood—that makes sense.

This addresses the concerns I had here. The only other thing I was going to suggest would be raising an error when the maximum canvas size is exceeded, but it looks like that's already noted in vega/vega#1522.

Thanks for your help!

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

2 participants