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
Hi, I'm not sure the intent of Charts, so I'm not sure if this is a bug or just an implementation detail.
Say you have a stacked bar chart with 3 values per bar, and want to control the text color of the value within each part.
BarChartDataSet dataSet;
(...)
dataSet.colors = @[[UIColor yellowColor], [UIColor purpleColor], [UIColor darkRedColor]];
// chosen to contrast with above, as black will be hard to read on purple and darkRed
dataSet.valueColors = @[[UIColor blackColor], [UIColor whiteColor], [UIColor whiteColor]];
In the current implementation you end up with the 1st bar drawing black text over yellow, purple, and darkRed, and the 2nd bar drawing white over yellow, purple, and darkRed.
What I would like is to have those colors rotated per bar part. So that black text is drawn over yellow, white over purple, white over darkRed.
For bar charts, this seems more logical to me then the colors applying to the entire bar, but I'm sure I haven't considered all the cases, or perhaps I am missing some other configuration that accomplishes this.
The behavior that I describe as desired above can be accomplished in HorizontalBarChartRenderer by changing this:
drawValue(context: context,
value: valueText,
xPos: x,
yPos: y + yOffset,
font: valueFont,
align: textAlign,
color: dataSet.valueTextColorAt(j))
to this:
color: dataSet.valueTextColorAt(k))
The text was updated successfully, but these errors were encountered:
I see your point. you want to label has different color for each segment, and each bar has the same pattern. Currently the same bar will have the same text color, not the segment. Currently you can change to k on your side. We need time on this.
However, people may want what the current is. Seems we could add more switches? @danielgindi what you think?
Hi, I'm not sure the intent of Charts, so I'm not sure if this is a bug or just an implementation detail.
Say you have a stacked bar chart with 3 values per bar, and want to control the text color of the value within each part.
In the current implementation you end up with the 1st bar drawing black text over yellow, purple, and darkRed, and the 2nd bar drawing white over yellow, purple, and darkRed.
What I would like is to have those colors rotated per bar part. So that black text is drawn over yellow, white over purple, white over darkRed.
For bar charts, this seems more logical to me then the colors applying to the entire bar, but I'm sure I haven't considered all the cases, or perhaps I am missing some other configuration that accomplishes this.
The behavior that I describe as desired above can be accomplished in HorizontalBarChartRenderer by changing this:
The text was updated successfully, but these errors were encountered: