Closed rahulsingh7 closed 3 years ago
Lines cannot have different strokes, opaticites, colors, etc. along their length. If you want to change these properties for only a portion of the line, you'll have to use an encoding to draw two separate lines.
If you are OK with changing the size of the line instead of opacity, stroke, or color, you can use mark_trail
instead of mark_line
:
line = base.mark_trail(color='black').encode(
y=alt.Y('sum(cases_7D):Q'),
tooltip = [alt.Tooltip('sum(cases_7D):Q',title='7 Day Rolling Average',format='.0f'), alt.Tooltip('date:T',title='Date')],
size=alt.condition(alt.datum.date <= alt.expr.toDate('2020-12-07T00:00:00'), alt.value(3), alt.value(1)))
Thanks again @joelostblom, This workaround works for me... :)
I want to make the line after December 7th, 2020 as dashed or at least reduce the opacity of it after 7 Dec 2020 but neither opacity nor strokeDash is having any effect on the line...
.................Code Snippet ..................
This code Gives me
I basically want to make the line after 7-dec-2020 to be dashed or reduce it's opacity just like I did for the bars in the chart.