Customizing the Scale of Graph Data Axes

Several properties provide control of the way that axes are scaled. These properties are members of the BaseDataAxis class.

The following properties control the upper limit of a data axis:

Property

Description

AxisMaxAutoScaled

Whether the graph automatically sets the upper limit

AxisMaxValue

What the upper limit is when the graph does not set it automatically

The following properties specify the lower limit of the axis:

Property

Description

AxisAutoScaledFromZero

Whether the lower limit is zero or the lowest data value, when the graph automatically sets the lower limit

AxisMinAutoScaled

Whether the graph automatically sets the lower limit

AxisMinValue

What the lower limit is when the graph does not set it automatically

The following properties specify the number of tick marks along the axis:

Property

Description

MajorTickStepAutomatic

Whether the graph automatically calculates the location of the tick marks

MajorTickStep

The value to count by for tick marks

MinAutoMajorTickStep The minimum tick step when the graph automatically calculates the location fo the tick marks.

The following properties specify the logarithmic scale of the axis.

Property

Description

ScaledLogarithmic

Whether to use a logarithmic scale or a linear scale (linear is the default)

LogarithmicBase

The base for the logarithmic scale, when the scale is logarithmic

The Ascending property specifies the direction of the axis.

Example: Setting the high value of an axis

The following code specifies the high value of the Y1-axis in a graph to be 400. The low value is set automatically at zero, following the default behavior. This example assumes that the graph variable is graph.


Y1Axis yaxis = graph.getY1Axis(); yaxis.setAxisMaxAutoScaled(false); yaxis.setAxisMaxValue(400.0);

Example: Changing the scale in order to exaggerate differences

This example shows how to change the scale of the data axes, so that the differences among the data values are more exaggerated. Because the default behavior of the graph is to start all data axes at zero, data in a scatter or bubble graph that is clustered around the high ends of the axes is difficult to distinguish. In this case, you might want to scale both the X-axis and the Y1-axis from the lowest data point, rather than from zero.

The following code sample shows how to zoom in on data by changing the automatic scale so that zero is not the lowest value on the axis. This code assumes that you have a graph variable named graph and that the graph type has an X-axis rather than an ordinal axis.


graph.getX1Axis().setAxisAutoScaledFromZero(false); graph.getY1Axis().setAxisAutoScaledFromZero(false);

Example: Setting the spacing of tick marks

This example shows how to specify the numeric distance between the tick marks on a data axis. The following code sets the tick marks to appear at 0, 5, 10, 15, 20, and so on. This example assumes that you have a graph variable named graph.


Y1Axis yaxis = graph.getY1Axis(); yaxis.setMajorTickStepAutomatic(false); yaxis.setMajorTickStep(5.0);