2

I am beginner in iOS development .I am developing an application and I want create pie chart using dynamic data from JSON.

Data will looks like:

   {
    "name": "Sales",
    "total_earning": "904006",
    "per": 40.41
     },
    {
    "name": "Service",
    "total_earning": "596845",
    "per": 26.68
    }

I want display "per" in pie chart and it's dynamic values. Can you tell me which is the best way?

This pie chart for Department wise Earning Report in Android I want to make

Jaywant Khedkar
  • 5,941
  • 2
  • 44
  • 55

1 Answers1

2

You can use dlpiechart class of dilipajm in GitHub, then, modify property & var for your purpose. Hope its useful.

Jaywant Khedkar
  • 5,941
  • 2
  • 44
  • 55
Nik
  • 176
  • 1
  • 9
  • Thank You it work for me @nik ,but in slices of pie chart display integer value ,77.68 it display only 77 .Could you tell me how to fix it. – Jaywant Khedkar Sep 12 '15 at 10:10
  • @JaywantKhedkar : in DLPieChart.m file, find method **- (CGFloat)pieChart:(DLPieChart *)pieChart valueForSliceAtIndex:(NSUInteger)index** {} , then modify line below: return [[self.DLDataArray objectAtIndex:index] intValue]; to: return [[self.DLDataArray objectAtIndex:index] **floatValue** ]; Hope its helpful. – Nik Oct 31 '15 at 11:14
  • I had modified return [[self.DLDataArray objectAtIndex:index] floatValue ]; but still facing same problem ,When I change return value it show me round off value i.e 77.68 it show me like 78.Could you have any idea how I can fix that . – Jaywant Khedkar Nov 02 '15 at 06:09
  • @JaywantKhedkar: in DLPieChart.m, find method **- (void)updateLabelForLayer:(SliceLayer *)pieLayer value:(CGFloat)value** {} , then change: @"%0.0f" to: @"%.2f". Hope its useful. – Nik Nov 02 '15 at 08:23
  • @Nik : How can i remove side boxes – sabir Sep 07 '16 at 10:18
  • @sabir: you mean that removing legend of piechart? In DLPieChart.m, comment out line 706 below: // [self drawLegends:layerHostingView dataArray:dataArray]; – Nik Dec 26 '16 at 12:57