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

Highlight selected line by changing line width or line color #721

Closed
waydevin opened this issue Jan 28, 2016 · 1 comment
Closed

Highlight selected line by changing line width or line color #721

waydevin opened this issue Jan 28, 2016 · 1 comment

Comments

@waydevin
Copy link

When users tap on a multi-lines line chart I want to make the nearest selected line change either it's width or it's color to let them know which line they're selecting.

What I could think about solving this problem in a method of ChartViewDelegate:

func chartValueSelected(chartView: ChartViewBase, entry: ChartDataEntry, dataSetIndex: Int, highlight: ChartHighlight){
  switch dataSetIndex{
  case 0:
  // reset chart to highlight line 0
  case 1: 
  // reset chart to highlight line 1
  default: //...

}

This method seem to be the only one that allows me to do some changes to a line chart depending on user's tapping on a line chart.

I could reset a line chart's data set which contains the line width/color properties to achieve what I want,
but I think it's not worthy to reset a whole chart for highlighting just one line.

Is there any easier way to do this?
Thanks for this awesome library and your support!

@liuxuan30
Copy link
Member

I would prefer override drawLinear/Cubic to check highlight there and highlight the line by colors. Overrding highlighted method would require another loop connecting the dots

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