2

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?

pkc456
  • 8,350
  • 38
  • 53
  • 109

1 Answers1

1

You need to use below method for BarChartDataSet

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

Just Replace initWithYVals to initWithValues.

CodeChanger
  • 7,953
  • 5
  • 49
  • 80
  • What will be the alternative of `barSpace` property. Error:- Property 'barSpace' not found on object of type BarChartDataSet. – pkc456 Jan 23 '17 at 12:49
  • I think that was removed from `BarChartDataSet` and added into `BarChartData` please check this link : https://github.com/danielgindi/Charts/issues/1849 – CodeChanger Jan 23 '17 at 12:58
  • What is the alternative of `[[BarChartData alloc] initWithXVals:xVals dataSets:dataSets]` ? – pkc456 Jan 24 '17 at 05:18
  • `[[BarChartData alloc] initWithXVals:xVals dataSets:dataSets]` alternative is `BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets];` – CodeChanger Jan 24 '17 at 05:33
  • I really appreciate your helping hand to resolve my problem. Can I ask more alternative please. Alternative of `[[BarChartDataEntry alloc] initWithValue:obj.quantity.doubleValue xIndex:i]` ? – pkc456 Jan 24 '17 at 05:37
  • I am happy to help you but its good to ask new question with all your query combine in single question. use this alternative option method : `[[BarChartDataEntry alloc] initWithX:index y:yValue]`. – CodeChanger Jan 24 '17 at 05:42
  • is your problem solved ? if yes can you accept this answer so other can find it helpful ? – CodeChanger Jan 25 '17 at 05:08
  • Please [have a look at new question](http://stackoverflow.com/q/41892396/988169) which is related to `ios-charts`. I am sure that you can help me to resolve this. – pkc456 Jan 27 '17 at 11:02