Spacing between columns with multiple series


#1

I have created a column chart which needs custom colors for each bar. So I have created multiple series, so I can set the color of each series. Now I would like to decrease the space between each series (column). I have tried setting interSeriesPadding and interSeriesSetPadding each to zero, but there is still a large space between the columns. If I create the chart with a single series with multiple data points, I can modify the column spacing (but I need multiple series, each with 1 datapoint in order to customize the color of the columns).

Any help is appreciated.


#2

Hi keilani,

When you use a different series for each point, the chart lays out the columns to leave space for one point in each series at each x-value, which is why you see the large spaces.

The recommended way to customize the color of the columns is to use individual point styling. There’s a full working example on github.

Kind regards,

Alison


#3

Hi Alison,
Thanks for the info. Got the columns colored individually, as needed. Can’t seem to color the labels individually however. Seems the dataPointLabelStyle doesn’t get set in the styleForPoint method, only in the seriesAtIndex method. Any guidance here?


#4

Hi Keilani,

You can style the labels individually using the delegate method sChart(_ chart: ShinobiChart, alter label: SChartDataPointLabel, for dataPoint: SChartDataPoint, in series: SChartSeries) on SChartDelegate.

Kind regards,

Alison