Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change chart legend show order #3791

Closed
devssun opened this issue Dec 20, 2018 · 2 comments
Closed

Change chart legend show order #3791

devssun opened this issue Dec 20, 2018 · 2 comments

Comments

@devssun
Copy link

devssun commented Dec 20, 2018

I use Combined Chart (Line and Bar), and show legend in order LineChart label , BarChart label.
but I want to show label in order BarChart label, LineChart label.
Is there any options to order Chart label not use Legend Class? I can't find anymore...
If there any options how can I order Chart label?
Thanks for your help.

@liuxuan30
Copy link
Member

maybe ask on stack overflow.
I remember you can change the render order. Just take a look how the legend get the order.

@dosedo
Copy link

dosedo commented Jul 10, 2020

问题还是18年提问的,现在2020年过去一半了。还是没有找到legend的排序方法。 但我朋友摸索出了一个偏方,如下:
Combined Chart (Line and Bar)中,将line的label置空。也就是隐藏line的legend. 然后 在barData中创造一个无数据的dataSet,其label设置为line的label值。这样达到偷天换日的目的。哈哈哈 。

示例:
BarChartDataSet *nullDataSet =
[[BarChartDataSet alloc] initWithEntries:@[[[BarChartDataEntry alloc] initWithX:0 y:0]] label:@"我是line"];
nullDataSet.drawValuesEnabled = NO;
nullDataSet.drawIconsEnabled = NO;
BarChartData *barData =
[[BarChartData alloc] initWithDataSets:@[barDataSet,nullDataSet]];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants