简体   繁体   中英

Vega-lite chart horizontal rule "jumps" with some datasets but not others

I'm trying to build what I think should be simple functionality using vega-Lite, but I'm struggling to get it working.

So I basically have a simple line chart plotting values on the y axis and frequency on the x axis. So far so good, no problem.

Now what I want is a vertical rule I can use to select an arbitrary point (frequency) on the X axis with the mouse. The rule should follow this point.

I actually have this working, however, on some datasets the rule sort of "jumps" on the axis, making it so that not all frequencies are selectable. You can see a Gist with one of the problematic specs here: https://gist.github.com/mkoelbaek-skyspecs/cbb49c75db743a4179a82b8a48f8c2da . Try showing it in vega-editor and dragging the selection rule and you'll see that it "jumps" and some points are not actually selectable. (Couldn't like to vega-editor directly since the url-encod with the dataset was to large for Stack Overflow).

What am I doing wrong?

Thank you in advance

So it turns out vegas "nearest" functionality got confused due to the sheer amount of data points I had. (I guess it's beta still).

I ended up creating a new field on my dataset called "SelectionX" which was still frequency, but locked to n discrete steps (400 in my case). Then SelectionX is what I'm using to set my rule parameter, and it works!.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM