Core Plot - Initial zoom for bar graph

Asked

Viewed 57 times

1

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

Example:

Chart 1:

Maximum Values: X = 100; Y = 110;

Graph 2:

Maximum Values: X = 180; Y = 230;

I need the initial zoom to show both graphs equally. Because if I set a default zoom, on a graph I show it completely, but on another it will cut part of the graph.

  • 1

    Do you Speak Portuguese? If not, head up to [so]. If so, please translate your question.

1 answer

1


I decided 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 defined the maximum and minimum value I want to present within plotspace. I did some calculations by raising the maximum range of the Y-axis by 25% of the maximum value of a bar to cover the full length of the bar. For the calculation of the X-axis, I calculated the number of bars to show all the bars.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.