Setting up ShinobiControls Bar chart

1.2k Views Asked by At

I am using ShinobiCharts to create this kind of bar graph:

enter image description here

But I have come up to few issues. It is impossible to set up different colors for bars, therefore I must use series to color bars differently. So my issues are:

  1. When I use series, the names do not match bar centers.

  2. Bars are always resized and repositioned according to datapoint count (I would like them to be static and if i got one datapoint it would stay in position #1 and having 6 more datapoints would not alter position of datapoint #1).

  3. Bar width (thickness) is always automatically set and if i set it with:

    [yAxis setDefaultRange:[[SChartNumberRange alloc] initWithMinimum:@1 andMaximum:@2]];

Chart gets oversized and only one bar is visible (values do not alter the thickness at all). y axis is SChartCategoryAxis and x axis is SCHartNumberAxis.

No other modifications are made, i just set two values and color. initialisation is also bare minimum from sample.

This is how it looks now:

enter image description here

NOTE: No panning or zooming allowed.

And I know its multi-question here but I would like to end this struggle of mine.

1

There are 1 best solutions below

0
On BEST ANSWER

Okay, so here are the answers that i found.

1) To make series names match bar centers, add this in seriesForIndex method:

series.stackIndex = [NSNumber numberWithInt:1];

This property is not mentioned in my 2.0 documentation (which i got after buying premium few days ago), it turns out 2.3 documentation covers this property: http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiCharts/2.3.0/Premium/Normal/Classes/SChartCartesianSeries.html#//api/name/stackIndex .

2) On my numberOfSeries method i do this:

- (int)numberOfSeriesInSChart:(ShinobiChart *)chart {

chart.yAxis.rangePaddingHigh = [NSNumber numberWithInt:(kEntriesToDisplay-[_receivedData count])];
return [_receivedData count];
}

What i basically do is set free spaces above my data (use min to set below data). I set empty spaces to meet my defined entry count.

3) Well i did not get an answer for this one, but since all bars are static the size of bars get optimal and therefore fits my needs (although i would like to be able to configure that anyway).