APLX Help : System Classes : The Chart and Series Objects : Customizing the Chart using the Draw method
|
|
![]() |
Customizing the Chart using the Draw method |
You can add extra features to the display of a Chart object by using the
For this to be useful, you need to be able to relate your However, an easier way of ensuring that your ∇Chart_Polar;xdata;ydata;angle;radius;⎕IO;Polar [1] ⍝ Sample line chart used as a 'polar' chart [2] ⍝ Draw line where radius is a function of angle from horizontal [3] Polar←'⎕' ⎕NEW 'Window' ⋄ Polar.scale←5 ⋄ Polar.size←548 512 [4] Polar.title←'Sample: Polar' [5] Polar.Chart.New 'Chart' ⋄ Polar.Chart.align←¯1 [6] Polar.Chart.fonttitle←'APLX Upright' [7] Polar.Chart.title←'r = ⊖ (1 + sin ⊖)' [8] ⎕IO←0 [10] angle←(⍳400)÷20 [11] radius←angle×(1+1○angle) [12] ⍝ [13] ⍝ Convert polar coordinates to XY coordinates [14] xdata←radius×2○angle [15] ydata←radius×1○angle [16] ⍝ [17] ⍝ Set the scale to be ¯40 to +40 along both X and Y axes [18] Polar.Chart.xmajorticks←¯40 ¯30 ¯20 ¯10 0 10 20 30 40 [19] Polar.Chart.ymajorticks←¯40 ¯30 ¯20 ¯10 0 10 20 30 40 [20] ⍝ [21] ⍝ Plot the data as though it were a line chart [22] Polar.Chart.s1.New 'series' ⋄ Polar.Chart.s1.xvalues←xdata [23] Polar.Chart.s1.yvalues←ydata ⋄ Polar.Chart.s1.linewidth←2 [24] ⍝ [25] ⍝ Use the Draw method to add circular reference lines [26] Polar.Chart.Draw 'Scale' 7 ⍝ Use Chart coordinates [27] Polar.Chart.Draw 'Pen' 1 200 200 200 ⍝ Light gray [28] Polar.Chart.Draw 'Mode' ¯1 9 ⍝ Mode 9 so that ticks show through [29] Polar.Chart.Draw 'Brush' 0 ⍝ Transparent so circle not filled [30] Polar.Chart.Draw(⊂'Circle'),((⊂0 0),¨10×1+⍳4) [31] ⍝ [32] ⍝ Wait until window is closed [33] 0 0⍴⎕WE Polar ∇ This
give the following effect, where the circular gray lines come from
the |
|
APLX Help : System Classes : The Chart and Series Objects : Customizing the Chart using the Draw method
|
Copyright © 1996-2010 MicroAPL Ltd