Tap Piechart with one datapoint doesn't call delegate methods


#1

Hello. 

I Have a pie chart that in some cases contains one datapoint only as the second one is 0 so that one doesn’t gets presented. So I see a big red circle.

Thing is the representation of that circle is a general overview of what is inside that area. When I tap on it I want to redraw the chart with the data that this slice represents. 

All works fine when the slices values of the chart are > 0, but if if there are  0 (except for one), I try to tap that one that is being rendered, but none of the delegate methods get’s called.

I dunno what am I doing wrong.

Any clue?

Thx

Gustavo


#2

Hi Gustavo,

Can I get you to clarify the problem you’re having?

When all of the datapoint values in your pie chart are greater than zero the delegate methods you’re using work fine when tapping a your chart. However, if one or more of your datapoints have a value equal to zero then the delegate methods you are using don’t get called. Is this correct?

Also, which delegate methods  are you using that aren’t getting called?

Kind Regards,
Andrew Polkinghorn


#3

Hello Andrew.

When my datapoint of my pie chart  are greater than 0, I can toggle a selection of any slide by touching at it. But when one datapoint of my pie series is 0, then the other/s which data point aren’t 0  no delegate method gets called.

  • – sChart:toggledSelectionForSeries:nearPoint:atPixelCoordinate:
  • – sChart:toggledSelectionForPoint:inSeries:atPixelCoordinate:
  • – sChart:toggledSelectionForRadialPoint:inSeries:atPixelCoordinate:

And i don’t know how to acces the subcategory data,that those slices (data point greater than 0)  contains so to redraw the chart.

Regards

Gustavo


#4

Hi Gustavo,

I replicated the conditions you described in our PieChart Demo which is attached to every download of our charting component and the toggle selection methods were getting called.

Is it possible for you to paste the code where you create and customise your SChartPieSeries and your datasource’s “-sChart:dataPointAtIndex:forSeriesAtIndex:” method? 

Kind Regards,
Andrew Polkinghorn


#5

Mark Hi.

here is the code wher eI create the  pieseries

    SChartPieSeries *p = [SChartPieSeriesnew];
//    p.style.protrusion = 20 ;//self.level == 0 ?20.0:0;
     p.selectedStyle.protrusion = 10.0f;
    p.style.showCrust = NO;
     p.selectedStyle.crustThickness = [NSNumbernumberWithDouble:3.5];
     p.selectedStyle.showCrust = YES;
    p.style.showLabels = YES;
     p.selectedStyle.showLabels = YES;
    
     //colors
     p.style.flavourColors = [selfchartColorsAtLevel:self.level];
     p.selectedStyle.flavourColors = [p.styleflavourColors];
     p.selectedStyle.crustColors = [selfchartColorsAtLevel:self.level];
     p.outerRadius = 150.0f;
     p.selectedPosition = nil;
    
     p.style.chartEffect = self.level == 0 ? SChartRadialChartEffectFlat:  SChartRadialChartEffectRounded;
     p.selectedStyle.chartEffect = SChartRadialChartEffectFlat;

and data source

    SChartRadialDataPoint *dp = [SChartRadialDataPointnew];
    NSString *key = [self keyForDataObjectWithIndex:dataIndex];
    id val = [self.dataForChart valueForKey:key];
    NSString * valString;
     if(!self.isInNumberTransactions){
        dp.value = [val doubleValue] < 0 ? [NSNumber numberWithDouble:-1 * [val doubleValue]] : val;
        valString = formatMoneyToCurrency([val doubleValue], self.selectedAccount.currency);
    }
    else{
        dp.value = [NSNumber numberWithInt:[val count]];
        valString = [NSString stringWithFormat:@"%i",[val count]];
    }
    dp.name = [NSString stringWithFormat:@"%@   %@",key,valString];

So basicly , I have at level 0 a pie chart ploting Expenses and Incomings, and if I tap any of the slices the charts redraws showing the subcategory of Expenses or Incomings.  I for expample Incomings’s datapoint value is 0, then I can’t tap Expenses and visceversa. 

G.


#6

Hi Gustavo

I have investigated into this issue and I have came to the conclusion that you’ve found a bug. This issue has been added to our backlog and a fix will be added in a future release.

One way to get the toggle selection methods to work is by setting one datapoint with a value of zero to something miniscule, I used 0.00001 and that seemed to fix the issue. 

Let me know how you get on.

Kind Regards,
Andrew Polkinghorn


#7

Hello Mark.

Thanks for the temporary fix,  how can i get informed of the new update when avaiable? 

g.


#8

Hi Gustavo,

I can put a notification in our system to update this forum thread when the fix for this bug is released if you like?

Kind Regards,
Andrew Polkinghorn


#9

MrAPolk

Hi Gustavo

I have investigated into this issue and I have came to the conclusion that you’ve found a bug. This issue has been added to our backlog and a fix will be added in a future release.

One way to get the toggle selection methods to work is by setting one datapoint with a value of zero to something miniscule, I used 0.00001 and that seemed to fix the issue. 

Let me know how you get on.

Kind Regards,
Andrew Polkinghorn

Hi Andrew,

I have found the issue when all datapoint value is zero. Our application will be crashed.

By setting datapoint value as 0.00001 or less than does not make sense when we have 4 datapoint with 0.00001 value because this pie/donut slice must not be seen on the chart.

Is this bug has been fix on version 2.6.1? How about work-around method to avoid the crash and does not display the mislead graphic on chart?

Best regards,

Chawalit