iOS SChartDateTimeAxis column width


#1

Is there any way to specify the width of a column using a SChartDateTimeAxis, or to set a SChartDateFrequency value to a datapoint?

I’m trying to create a column chart using a SChartDateTimeAxis but when I set the xValue of the datapoint to an NSDate value it gives me a column too tiny to see on the iPhone. It seems to treat it as a one-second value and assigns it space in the chart accordingly. If I format it as a string at this point it gives me a reasonably sized column, but the formatting gets overwritten so the tick labels are incorrect. 

I tried creating the same chart using a category axis but I can’t set the major tick frequency so the labels all overlap and it looks terrible.


#2

Hi there,

This is currently a known issue with our older version of charts - to calculate the width of columns, we find the smallest distance between two consecutive columns and use half that distance for the column’s drawing space. So when there is a single column we run into a special case, and in the older version of charts we would give this column a fixed width, which doesn’t work well on charts with large ranges (as you found). The new release, due out in a few weeks, resolves this by using half of the range as the column width, however this is really a best guess, since we don’t have anything to go off for a single column.

There are a few solutions, one of which will work with any version of charts, so I’ll suggest that - this workaround is just for the case where you have a single column, and involves creating an extra “hidden” datapoint, which has a y-value of zero (or whatever the baseline of your column series is). This way the column won’t be displayed, but the column width for your lone column will be calculated from the distance between the two datapoints you provide, allowing you to customise this exactly as you need.

I hope the above helps. Being able to easily set the width of the columns is an issue high up our priority list so this should hopefully be resolved fairly soon.

Thanks,

Sam


#3

Hi Sam,

This isn’t a case where I have just one column - there are many columns in the graph but as the period on the DateTimeAxis is spread over a number of weeks/months and the datapoint for each column is an NSDate it treats each column as a one second period - hence the columns are too tiny to render as they are only taking up the space of one second out of a period of millions of seconds.


#4

Ah sorry, I misunderstood.

Would you mind sending a sample to us that replicates your problem to info@shinobicontrols.com? It’d be a great help in trying to narrow down the issue.

Kind regards,

Sam