ChartView icon indicating copy to clipboard operation
ChartView copied to clipboard

style not changing in SwiftUI?

Open gbucas opened this issue 3 years ago • 1 comments

I have the following code. Everything works great but the "chartStyle" does NOT change for "Case 1:" An I doing something wrong or is that a bug?

switch self.HKinfo.chartActivity { case 0: BarChartView(data: ChartData(points: self.HKinfo.dailyMoveCals), title: chartTitle, form: ChartForm.extraLarge, dropShadow: false) case 1: let chartStyle = ChartStyle(backgroundColor: Color.black, accentColor: Color.greenYellow, secondGradientColor: Color.greenYellow,textColor: Color.white, legendTextColor: Color.white, dropShadowColor: .black ) BarChartView(data: ChartData(points: self.HKinfo.dailyExerciseMins), title: chartTitle, style: chartStyle, form: ChartForm.extraLarge, dropShadow: false) case 2: BarChartView(data: ChartData(points: self.HKinfo.dailySteps), title: chartTitle, form: ChartForm.extraLarge, dropShadow: false) default: BarChartView(data: ChartData(points: self.HKinfo.dailyTotDistance), title: chartTitle, form: ChartForm.extraLarge, dropShadow: false) }

gbucas avatar Apr 01 '21 05:04 gbucas

i was also having this issue - it was because of darkModeStyle. i looked at the init for BarChartView and set self.darkModeStyle = style instead of whatever was there before. hope this helps

artemas-radik avatar Apr 30 '21 18:04 artemas-radik