Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
Series titles in legend for stacked charts
posted

Hi,

How can i set the series titles (the ones displayed in the chart legend) to display something different than "value1", "value2", "value3"?

I´ve tried the method "setTitle:forFragmentSeriesAtIndex:" in IGStackedSeriesBase, but the legend keeps displaying the same values.

I´m using one of the examples provided in the documentation: http://help.infragistics.com/iOS/2013.1/?page=IGChartView_Stacked_100_Area_Series.html

Thanks in advance!

Parents
No Data
Reply
  • 4940
    Verified Answer
    Offline posted

    Hi Matias,

    For the sample you mentioned, you would first need to get the returned series object when adding the series.

    IGStacked100AreaSeries *stackedSeries = (IGStacked100AreaSeries *)[_chartView addStackedSeriesForType:[IGStacked100AreaSeries class] usingKey:@"series" withDataSource:_stackedChartDataSourceHelper firstAxisKey:@"xAxis" secondAxisKey:@"yAxis"];

    Then, with this series object you can set the title on each value fragment.

    [stackedSeries setTitle:@"Title 1" forFragmentSeriesAtIndex:0];
    [stackedSeries setTitle:@"Title 2" forFragmentSeriesAtIndex:1];
    [stackedSeries setTitle:@"Title 3" forFragmentSeriesAtIndex:2];

    Although, there is currently a bug when setting the title that prevents the legend item from updating. This will be fixed in the next service release. The workaround you can use in the meantime is shown below.

    [stackedSeries replaceWithFragmentSeries:[stackedSeries.series objectAtIndex:0] atIndex:0];
    [stackedSeries replaceWithFragmentSeries:[stackedSeries.series objectAtIndex:1] atIndex:1];
    [stackedSeries replaceWithFragmentSeries:[stackedSeries.series objectAtIndex:2] atIndex:2];

    This workaround causes the legend to update and display the updated title. We apologize for the inconvenience.

Children