问题
I have implemented a bar chart and I would like to move to a more specific on click on that bar chart. for that I am using "ChartViewDelegate(Chartviewselected)" it is working fine. but issue is first time when I select bar chart it goes smothly to next screen. but when come back on that screen selected bar shows selected default, when click on that bar again then it gets unselected. because of that chartview delegate(chartview selected) method not called. So I want to disable default selection of bar chart. is there any property to disable selection of bar chart?
回答1:
Use dataSet.highlightEnabled = false
回答2:
When coming back to the screen try calling:
lineview.delegate!.chartValueNothingSelected!(lineview)
According to ChartViewBase.swift:
// Called when nothing has been selected or an "un-select" has been made.
@objc optional func chartValueNothingSelected(_ chartView: ChartViewBase)
回答3:
If you need to removed highlighted Bar while come back from Previous screen put below code in viewWillApper()
it will remove highlighted Bar.
//Manyally Remove Selected Bar
[self.chartView highlightValues:NULL];
Hope this will helps!
来源:https://stackoverflow.com/questions/43907455/how-to-disable-selection-of-bar-char