How to set different values for data and legend entries
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to set different values for dataset entry and legend entry, but it does not work.
Need:
PieChartDataEntry: number
ChartLegendEntry: text
Extra:
Also, I can not find how to swap position of percentages and value labels?
How to hide the number and percent value in a small slice?
Thank you in advance!


for (int i = 0; i < parties.count; i++) {
float value = (arc4random_uniform(mult) + mult / 5);
[values addObject:[[PieChartDataEntry alloc] initWithValue:value
label:[NSString stringWithFormat:@"%.0f", value]]];
ChartLegendEntry *entry = [[ChartLegendEntry alloc] init];
entry.label = parties[i];
[legendEntries addObject:entry];
}
_pieChartView.legend.entries = legendEntries;
PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithValues:values label:@""];
dataSet.colors = colors;
PieChartData *data = [[PieChartData alloc] initWithDataSet:dataSet];
Contributor guide
Assessment
This issue has not been assessed yet.