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

PieChartView Can not highlight which i want to highlighted #3110

Closed
codeliu6572 opened this issue Dec 18, 2017 · 9 comments
Closed

PieChartView Can not highlight which i want to highlighted #3110

codeliu6572 opened this issue Dec 18, 2017 · 9 comments

Comments

@codeliu6572
Copy link

codeliu6572 commented Dec 18, 2017

I use PieChartView and want to highlighted one after init.I see lineChar can use
[self.chartView highlightValueWithX:0.0f y:0.0f dataSetIndex:3 callDelegate:NO];
and I test in piechart ,because piechart don't have an x and y,so,I give x and y 0.0f,and give SetIndex the index in the array, but it does not work except index=0,i want to know how to highlighted some one i wanted in piechart.Thankyou!

Expect your reply!

@codeliu6572 codeliu6572 changed the title PieChartView Can not hight which i want to heighted PieChartView Can not highlight which i want to highlighted Dec 18, 2017
@codeliu6572
Copy link
Author

codeliu6572 commented Dec 19, 2017

@liuxuan30 Can you show me how to highlight index greater than zero?I tried and it does not work.
chartView.highlightValue(x: 0.0, y: 0.0, dataSetIndex: 0, callDelegate: false)
Only when index is zero, it can work, why? I need index greater than zero, what should i do?

@liuxuan30
Copy link
Member

don't use coordinate if you are not familiar with. There are plenty of highlight methods, so use others. like @objc open func highlightValue(_ highlight: Highlight?)

@codeliu6572
Copy link
Author

codeliu6572 commented Dec 22, 2017

@liuxuan30 I tried this
ChartHighlight *high = [[ChartHighlight alloc]init];
high.dataIndex = maxIndex;
[self.chartView highlightValue:high];
dataSetIndex is readonly and can not use,I searched on the internet and find nothing about it, can you show me how to use highlight on piechart?Thank you.

@liuxuan30
Copy link
Member

I think you misunderstood? usually what you need to provide is data set index and entry index, etc, to only identify which entry in which data set to be used. DataIndex is only used in combined chart, in pie chart, dataSetIndex and dataIndex should always be 0 I suppose.

@liuxuan30
Copy link
Member

BTW, Try debug ChartDemo - pie chart, it has all the steps how highlight are created and highlighted. You can add a breakpoint at drawHighlighted method

@codeliu6572
Copy link
Author

@liuxuan30 You mean If i need to highlight one part of Piechart , i have to rewrite some method? If ChartDemo - pie chart has method ,can you tell me how to use it? I found highlight method contains x,y,even highlightValue(_ highlight: Highlight?) ,I googled bug found nothing useful,I suggest you add highlight method on PIeChartView.

@codeliu6572
Copy link
Author

@liuxuan30 I have solved this problem by using
[_chartView highlightValueWithX:4 dataSetIndex:0];

dataSetIndex is zero, and X is the index, but i don not understand why this work, but it solved my problem.Thanks anyway!Here I was to suggest your team write right method in the Demo to help developer, like me,I think most of developer will meet this problem,and your team certainly hope to let Charts more better.
Best wishes for you and your team!

@liuxuan30
Copy link
Member

liuxuan30 commented Dec 25, 2017

highlightValue API series eventually lead to the same final call. You can take a look at open override func drawHighlighted(context: CGContext, indices: [Highlight]) how your code work, and maybe you can find a better one.

BTW, pie chart by default nil-ed x axis. So pie chart does not have x axis

Thanks for your input. We will improve that. Well, if we got enough complains about that :)

@codeliu6572
Copy link
Author

Haha,I have seen some issues on GitHub,Really hope you improve that .Although it worked,i still worried some unknown question. If i rewrite this method, but you update some code ,you know, maybe
have other question. Hope your update.

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

2 participants