How can i change the color of X and Y series values according to light and dark themes.??
i tried may time and many ways to set --neutral-90 but nothing has changed.
The XY Chart component is an implementation of AM Charts XY Chart. Some of these external components are not theme aware.
I have worked around the problem as follows:
- Assume that any dark them will start with the letters “dark”.
- Create a Perspective session custom object. I called mine sessChartColorSet. Create enough values for the maximum number of pens you need.
- Create an expression binding on each of the values something like this:
if(left({this.props.theme}, 4) = 'dark',
"#0000cc",
"#000033"
)
- Bind each chart
props.series.0.line.appearance.stroke.color
to the appropriate session color. In this case it would besession.custom.sessChartColorSet[0]
.
It’s a bit of trouble but worth the effort if you are allowing users to select the theme. The default colors are a bit too similar to allow easy visual differentiation.
Tip: there’s an edit button (pencil icon) below your post which allows you to edit your post rather than create a second post with a correction.