Search code examples
iosswiftmpandroidchartios-charts

ios-charts / mpandroidcharts stacked bar label total instead of values of each entry


I am using ios-charts and successfully implemented a stacked barchart. However, I would like to display only the total of the stack at the top of each stacked bar, and not the value of each entry of the stacked bar. For now, all I've been able to do is hide the individual values with chartDataSet.drawValuesEnabled set to false.

Is it something that is doable?

Thanks!


Solution

  • Not sure if there is an easier way but you could use a MarkerView to accomplish this. The MarkerView will display for highlighted entries so after attaching it you would need to highlight all entries in the chart via one of the highlight methods:

    highlightValue(int xIndex, int dataSetIndex)

    Highlights the value at the given x-index in the given DataSet.

    highlightValues(Highlight[] highs)

    Highlights the values at the given indices in the given DataSets.