APLX Help : Help on APL language : System Functions & Variables : ⎕CHART Draw Chart of Data
|
|
![]() |
|
Implemented on desktop editions of APLX only
Data to be ChartedThe right argument to
Customizing the ChartThe optional left argument to It comprises a nested vector of one or more phrases of the form 'Keyword=Value'. (If there is only one such phrase, the argument can be a simple character vector). The options are as follows (case is ignored in checking the keywords): title - Sets the title for the whole chart, for example 'title=Absorbtion of Calcium' type - Sets the type of graph, for example 'type=area'. The value part of this phrase should be one of the following: line scatter area bar stair horizbar or pie. If you omit this phrase, a Line chart is drawn initially, unless the right argument is nested, in which case a Bar chart is drawn. Once the chart has appeared, you can change the type using the Chart menu. data - Specifies how the data is laid out in the right argument, for example 'data=rows'. The value part of this phrase should be one of the following: rows (the data points are along the rows of the right argument, or columns or cols (the data points are laid out down the columns of the right argument). If you omit this phrase, APLX uses the rules described above. Again you can adjust the choice once the chart has been drawn. x - Specifies which data set contains the X values. This can one of first (the X values are in the first row or column of the right argument), last (the X values are in the last row or column of the right argument), or implicit (all the rows/columns contain Y values, which should be plotted against 0, 1, 2...). If you omit this phrase, APLX tries to guess the most likely layout using the rules described above. seriesname - Allows you to specify a label to be attached to each series of the graph. You will normally want to repeat this phrase several times, once for each series in the chart. For example, if you wanted a chart showing sales for three regions against an implicit X axis of 0,1 2, you could provide an N by 3 array as the right argument, and for the left argument specify: 'seriesname=America' 'seriesname=Europe' 'seriesname=Asia' 'x=implicit'. The data in the first row would be labelled 'America', the second 'Europe', and the third 'Asia'. Live ChartingThe 'id' keyword can be used to tell Tip: If you want to chart a variable, and have the chart change when the variable changes (in desk calculator mode), you can use an expression like this in a Watch window: 'id=1' ⎕CHART X ExamplesDraw a sine wave. Because no X values are specified, implicit X values of 0, 1, .... 99 are used: ⎕CHART 1○0.1×⍳100 Draw a sine wave with the X values specified in degrees. We provide a two-column matrix; APLX assumes the second column is the X axis, because it increments regularly: ⎕IO←1 ⎕CHART (1○(10×0,⍳36)×○2÷360),[1.5]0,10×⍳36 Draw a bar chart: ⎕CHART 2 4⍴'Apples' 'Pears' 'Oranges' 'Kumquats' 445 323 345 765 Draw the same data as a pie chart: 'type=pie' ⎕CHART 2 4⍴'Apples' 'Pears' 'Oranges' 'Kumquats' 445 323 345 765 Draw some random data as two, named series, against implicit X values 0, 1, 2..: 'x=implicit' 'seriesname=Bicycles' 'seriesname=Tricycles' ⎕CHART ?2 8⍴100 Draw an animated graph ∇AnimatePulse;pulse;X [1] pulse←(*-X÷10)×1○4×X←⍳100 ⍝ Create some fake data [2] pulse←(⌽pulse),pulse [3] :Repeat [4] 'id=1' ⎕CHART pulse [5] pulse←2⌽pulse [6] :EndRepeat ∇ See also the Chart and Series system classes, which give you much more detailed control over the layout and appearance of graphs. |
|
APLX Help : Help on APL language : System Functions & Variables : ⎕CHART Draw Chart of Data
|
Copyright © 1996-2010 MicroAPL Ltd