You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to show the recent time in the data using a different color for an area chart with a dark line on top.
Since line and area marks are considered single entities I used transform_calculate to essentially group the data into 2 groups.
Using the stocks data I have the following observations -
However since the stroke lines are not exactly what I wanted (orange strokes in blue region and vice versa - although explainable), I decided to layer line on area as follows -
This gives the following -
This is more like what I want, but if you look closely you will notice that at the color transition the stroke (line chart) has a gap.
It is actually easy to explain that - recent actually starts from 2005-02-01 and the time between 2005-01-01 to 2005-02-01 does not have the line segment since there is no data and also that the two groups are separate.
I would expect the same behavior from area chart too, but its area seems to extend beyond.
I mean, ideally I want the line to behave the same way so that there are no discontinuities. Is there a way to make that happen? Also having an understanding of why area behaves this way would be helpful too.
The text was updated successfully, but these errors were encountered:
armsp
changed the title
Difference between line and area plot when coloring different sections for a discrete time series data
Irregularity between line and area plot when coloring different sections for a discrete time series data
Sep 8, 2020
I don't think there is any easy way to deal with this, unfortunately. I've seen questions related to step interpolation edges come up in the Vega-Lite forums, and never seen an answer that avoids adding edge-points to the underlying data. Please let us know if you figure out a good way around it.
I wanted to show the recent time in the data using a different color for an area chart with a dark line on top.
Since line and area marks are considered single entities I used
transform_calculate
to essentially group the data into 2 groups.Using the stocks data I have the following observations -
This gives the following -
However since the stroke lines are not exactly what I wanted (orange strokes in blue region and vice versa - although explainable), I decided to layer line on area as follows -
This gives the following -
This is more like what I want, but if you look closely you will notice that at the color transition the stroke (line chart) has a gap.
It is actually easy to explain that - recent actually starts from 2005-02-01 and the time between 2005-01-01 to 2005-02-01 does not have the line segment since there is no data and also that the two groups are separate.
I would expect the same behavior from area chart too, but its area seems to extend beyond.
I mean, ideally I want the line to behave the same way so that there are no discontinuities. Is there a way to make that happen? Also having an understanding of why area behaves this way would be helpful too.
The text was updated successfully, but these errors were encountered: