replacement for APLX's ⌷CHART

Learning APL or new to Dyalog? Ask "silly" questions here, without fear...

replacement for APLX's ⌷CHART

Postby shallit on Tue Apr 10, 2018 2:33 pm

What is Dyalog's replacement for ⌷CHART ? Suppose I just want a simple line graph like

⌷CHART ?⍳10

How can I do this in Dyalog?
shallit
 
Posts: 4
Joined: Fri Oct 27, 2017 12:25 am

Re: replacement for APLX's ⌷CHART

Postby Adam|Dyalog on Wed Apr 11, 2018 10:19 am

Try:
      ⎕CY'sharpplot'
c←⎕NEW SharpPlot
c.DrawLineGraph ?⍳10
3500⌶c.RenderSvg 100

Here is a small utility function that lets you give it data as right argument and optionally a chart type as left argument:

      {type}Draw data;Causeway;ref;types
:If 900⌶⍬ ⍝ called monadically
type←'line'
:Else
type←819⌶⍕type
:EndIf
Causeway←⎕NS ⍬
Causeway.⎕CY'sharpplot'
ref←⎕NEW Causeway.SharpPlot
types←'D'ref.⎕NL ¯3
types/⍨←{(3≤≢⍵∩⎕A)∧'Draw'∘≡4↑⍵}¨types
:If 0∊⍴data
:OrIf 0∊⍴type
ref←911 ⎕SIGNAL⍨'VALID TYPES:',∊{' ',¯1↓1↓⍵⊂⍨⍵∊⎕A}¨types
:Else
types/⍨←type∘{∨/⍺⍷4↓⍵}¨819⌶types
:If ×≢types
(ref⍎⊃types)data
:If ¯1=(4↓⊃types)(3500⌶)ref.RenderSvg 100
'RIDE browser not available'⎕SIGNAL 6
:EndIf
:Else
'Invalid type'⎕SIGNAL 11
:EndIf
:EndIf

SharpPlot has a lot of options. See e.g. here.
User avatar
Adam|Dyalog
 
Posts: 23
Joined: Thu Jun 25, 2015 1:13 pm


Return to New to Dyalog?

Who is online

Users browsing this forum: No registered users and 1 guest