Core Plot - Initial zoom for the bar chart

1

How do I set the initial zoom based on the maximum value of the X axis and Y axis?

Example:

Chart 1:

Maximum values: X = 100; Y = 110;

Chart 2:

Maximum values: X = 180; Y = 230;

I need the initial zoom to show the two graphs equally. For if I set a standard zoom, on one graph I show it completely, but on another it will cut part of the graph.

    
asked by anonymous 02.09.2014 / 20:04

1 answer

1

I solved it as follows:

plotSpace.yRange = [CPTPlotRange plotRangeWithLocation: CPTDecimalFromFloat(-(maxValueY * 0.25)) length: CPTDecimalFromFloat(maxValueAxisY)];

plotSpace.xRange = [CPTPlotRange plotRangeWithLocation: CPTDecimalFromFloat(-3.0f) length: CPTDecimalFromFloat(xRangeBasedCount)];

In this implementation I set the maximum and minimum value that I want to display within plotspace. I made some calculations by raising the maximum range of the Y axis to 25% of the maximum value of a bar to cover the entire length of the bar. For the X-axis calculation, I calculated by the number of bars to show all the bars.

    
05.09.2014 / 22:51