Axes, Coordinates and Scales
Apart from Pie charts, all the different chart types plot a dependent variable (known as Y) against another variable (known as X). By convention, the X axis is along the horizontal, and the Y axis is along the vertical, except for Horizontal Bar and Stacked Horizontal Bar charts, where the two are reversed.
By default, the Chart Object will select the scale of the chart (i.e. the range from the minimum X and Y coordinates to the maximum X and Y coordinates) automatically. It will also automatically choose where to place tick marks and labels along the axes. There are two types of tick mark; major tick marks (which are by default labelled), and minor tick marks (which are not labelled). The major tick marks are slightly longer. The Chart object chooses the intervals between tick marks to give a reasonable number of ticks depending on the size of the chart, and will place the marks at intervals which mean that the labels are round numbers (multiples of 1, 2, 5 or 10 times integral powers of ten).
The Chart object will also choose the intercepts, i.e. the point
where the axes cross each other. This will usually be 0 if 0 is
within the scale, else the lowest X or Y point on the scale. This
means that the Y axis is usually shown on the left of the chart, but
you can change this by using an alternate Y scale (see below), and
you can also cause the Y axis to be drawn on both sides of the chart
For Bar and Stacked Bar charts (and the Horizontal versions of these), the bars are by default drawn centred on integers 1, 2, 3.. etc.
The Alternate Scale
As well as the main Y scale, you can also specify that an alternate Y
scale is used for one or more of the series on the chart, by setting
∇Chart_ObesityTobacco;⎕IO;obesity;tobacco;Health  ⍝ Sample line chart with two different scales  Health←'⎕' ⎕NEW 'Window' ⋄ Health.scale←5 ⋄ Health.size←450 600  Health.title←'Sample: Obesity and Tobacco'  Health.Chart.New 'Chart' ⋄ Health.Chart.align←¯1  Health.Chart.type←'line' ⋄ Health.Chart.style←1  Health.Chart.title←'Tobacco Consumption and Obesity'  Health.Chart.subtitle←'United Kingdom'  ⎕IO←0  ⍝ Set up the data  obesity←1980 7 1991 14 1992 14 1993 15 1994 16 1995 16 1996 17  obesity←13 2⍴obesity,1997 18 1998 19 1999 20 2000 21 2001 22 2002 22  tobacco←1960 51.5 1970 49.5 1980 39 1990 30 1992 28  tobacco←10 2⍴tobacco,1994 27 1996 28 1998 27 2000 27 2001 27  Health.Chart.s1.New 'series'  Health.Chart.s1.marker←'⋄' ⋄ Health.Chart.s1.fillmarker←1  Health.Chart.s1.caption←'Tobacco consumption (left axis)'  Health.Chart.s1.values←tobacco  Health.Chart.s2.New 'series'  Health.Chart.s2.marker←'⋄' ⋄ Health.Chart.s2.fillmarker←1  Health.Chart.s2.caption←'Obesity (right axis)'  Health.Chart.s2.usealtscale 1  Health.Chart.s2.values←obesity  Health.Chart.yaxislabel←'% of population daily smokers'  Health.Chart.yaltaxislabel←'% of population with BMI>30 kg/m2'  Health.Chart.xmajorticks←1960 1970 1980 1990 2000  ⍝  ⍝ Wait until window is closed  0 0⍴⎕WE Health ∇
Line  of this function causes the second series to be drawn using the alternate scale, which is unrelated to the main Y axis scale. The effect is as follows:
Specifying your own tick positions and intercepts
If you wish, you can choose your own positions for the tick marks along
any of the axes. You specify the values where major tick marks
should be drawn by writing a vector of values to the Chart properties
If you specify your own tick positions, the final scale chosen will normally be from the lowest tick mark you specify to the highest. However, the scale will be extended if any of the points in any enabled Series is outside this range, so that the scale can represent all points on all the series.
In addition, you can change where the axes cross by specifying the
Specifying your own tick labels
By default, the Chart object writes a label next to each major tick
mark, showing the numeric value of the point on the axis. If you
wish, you can specify your own labels using the properties
There are two special cases. For Bar charts (including the stacked and
horizontal variants), there is no need to specify the X tick
positions, since the bars are always drawn at 1, 2, 3... For Pie
charts, there are no tick positions as such, but the
Specifying axis labels
Sometimes the range of data contained in a series is so large that a
logarithmic scale is more appropriate. You can cause a logarithmic
scale to be used for an axis by setting one of the
Note that, in this example, the minor ticks represent 2, 3, .. 9 times the power of ten shown at the previous major tick.
Copyright © 1996-2010 MicroAPL Ltd