here's (fiddle or gist you can paste into vega editor) a vega-lite project i'm working on. it's an interactive map of zip codes that lets you view a timeline of covid infections.
the color and y-scale are symlog, but that overemphasizes some rare negative values in the dataset (i guess when the health department reverses previously declared positive cases).
i'd like to use a piecewise scale to give less magnification to negative values. but when i add the following to my y-encoding scale, it seems to collapse the data to a single y value.
{ "domain": [-0.2 , 0, 1.4]
, "range" : [-0.05, 0, 1.4]
}
so what's the right way to specify a piecewise scale?
a few other questions i have:
- the selection colors for each zip are currently chosen as
nominalsinebowentries by zip, but since zip codes are spatially correlated, selecting nearby zip codes yields unhelpfully similarly colored lines (green in the example above). i think it would be better to use n equally spacedsinebowentries for n selections, but how can these be computed at selection time? - is there any way to include the
Line'spointjust when it is selected (not just using selection-dependentopacityorsize), rather than including a separateCircleMarklayerfiltered to the selection, as i have done? like setting theshapeencodingtonullor something? - is there any way to get a
tooltipalong theLines, not just at datapoints? i see it would be ambiguous which point's data to inspect, but i would thinkLines should address this. - looks like choropleth zoom+pan has been deferred for a couple years, even though
vegacan do it. what makes this so hard forvega-liteto pick up? are there any workarounds? i would consider switching tovega(also for new labeling support that's not yet invega-lite), but what is the best way to do this? i happen to usehvegainhaskellto generate myvega-liteand would rather continue to maintain as much as possible from there, is it possible to avoid switching to doing everything invega, only using it whenvega-liteis insufficient? i'm picturing something like avegainstruction toimport from vega-lite...


currently
rangeis not abstract, it is in concrete presentation units. in this case, 0 is at the top and goes positive downwards in pixels. i filed a proposal to change this here: https://github.com/vega/vega/issues/2954filed feature request here: https://github.com/vega/vega-lite/issues/7014. i don't think order/number selected is available, but many parameters can take expressions as values that could in principle be evaluated after each selection. https://vega.github.io/vega-lite/docs/mark.html#color https://vega.github.io/vega-lite/docs/types.html#exprref perhaps a selection predicate could be used to count the number currently selected? https://vega.github.io/vega-lite/docs/predicate.html#selection-predicate
on selection condition change it from
False? https://vega.github.io/vega-lite/docs/line.html#properties or on selection draw a whole new line with differentpoint, only way to have it draw on top of the unselected.https://github.com/vega/vega-lite/issues/6851#issuecomment-718103153
waiting...