Closed castillejoale closed 8 years ago
@protocol
xVals is array.Save Axis value.
Short answer: try ChartsDemo
Hello,
I wasn't able to make it work. This is what I did
1) I have implemented this protocol: ChartXAxisValueFormatter
2) Assigned the delegate:
self.degreesLineChart.xAxis.valueFormatter = self
3) Implemented the protocol method: (It never gets called)
func stringForXValue(index: Int, original: String, viewPortHandler: ChartViewPortHandler) -> String {
return "Hello"
}
I also tried to add the values directly to the axis like this, but it doesn't work either:
self.degreesLineChart.xAxis.values = ["0.0", "0.2"]
Any other tips?
@liuxuan30 The first thing I did was to try ChartsDemo, but it seems like the xAxis is being added automatically.
If you really tried ChartsDemo and played with it, you will find @interface DateValueFormatter
did the job (conform to IAxisValueFormatter
), and I don't know why you write stringForXValue
while it's stringForValue
and then xAxis.valueFormatter = [[DateValueFormatter alloc] init];
I don't know where is ChartXAxisValueFormatter
neither
http://stackoverflow.com/questions/40470604/linechartdata-without-x-values-on-constructor-charts-swift-3 The answer to this question solved the issue for me
Hello, I am able to displays the yAxis values but I haven't figured out how to show the xAxis values.
Here is a pictures of my graph:
Here is my code so far, as you can see I have been trying everything:
The chart is a LineChartView
Thank you so much
P.S. I am using tag v2.2.5, swift 2.3 in xcode 8.