AnyChart-Android icon indicating copy to clipboard operation
AnyChart-Android copied to clipboard

Can't implement dual light/dark mode charts!

Open aerizzo opened this issue 5 years ago • 4 comments

Hi! I want to implement dark mode setting in my app so chart can take light and dark background dinamically. But I can't set color programmatilly. Any alternative?

aerizzo avatar Jan 15 '20 20:01 aerizzo

@aerizzo All chart types support coloring background via API. Please, can you specify what chart type you are using?

Shestac92 avatar Jan 16 '20 03:01 Shestac92

@aerizzo All chart types support coloring background via API. Please, can you specify what chart type you are using?

Thanks for your answer Alexander, I want to change background and grid color on a Cartesian chart added to my AnyChartView object. Only method I found to change a background is related to chat view (anyChartView.setBackgroundColor(...);) Another question, if is this possible, can I change color dinamically and show new color schema through anyChartView.invalidate()? Any help is welcome

aerizzo avatar Jan 16 '20 23:01 aerizzo

@aerizzo For this purpose, you should use the library API. The following code describes how to adjust the chart background and grids:

Cartesian cartesian = AnyChart.bar();
cartesian.background().enabled(true);
cartesian.background().fill("black");
cartesian.xGrid(0).enabled(true).stroke("red");
cartesian.yGrid(0).enabled(true).stroke("red");
// rest of chart configuration code

The result below: Screenshot 2020-01-21 at 11 06 26

Shestac92 avatar Jan 21 '20 03:01 Shestac92

So the android lib does not support dark mode?

chitgoks avatar Mar 04 '22 04:03 chitgoks