Search code examples
iosobjective-cchartsxcode8ios-charts

Working with Charts( BarChartDataEntry) iOS library inObjective C with Xcode 8


I installed the Chart library (version 3.0.1) (https://github.com/danielgindi/Charts) in my objective-C project. In the previous version of my code, below line works successfully,

    BarChartDataSet *set12 = [[BarChartDataSet alloc] initWithYVals:yvals label:@"Water Consumed"];

In latest version of charts i.e 3.0.1, the above line results in build error:-

No visible @interface for 'BarChartDataEntry' declares the selector 'initWithValue:xIndex:'

I've BarChartDataSet class and there is no such method. What will be the replacement of this method in objective-C?


Solution

  • You need to use below method for BarChartDataSet

    BarChartDataSet *set1 = [[BarChartDataSet alloc] initWithValues:yVals label:@"Quarter Share"];
    

    Just Replace initWithYVals to initWithValues.