SharpPlot Table design

General APL language issues

SharpPlot Table design

Postby Leo on Thu Aug 23, 2018 8:48 am

Hello Dyalog APL-User,

My question about the attached SharpPlot program concerns the table.
The program is running.
The data are not relevant.
The table shows 7 columns instead of the desired 6 columns.
As can be seen from the plot, the first column headed "Y [mm]" is superfluous.

My questions about creating tables are:
1. How do you remove the first column?
2. How can change font type, font size and font color in the table?
3. What is the command for the heading "Coordinates" for the table?

Thanks for the help in advance!
Best regards
Leo

      ∇ ForumPlotTable;X1;X2;X3;Y1;Y2;Y3
[1] X1←⍳10
[2] X2←X1+0.5
[3] X3←X1+1
[4] Y1←0.2×X1
[5] Y2←0.4×X2
[6] Y3←0.6×X3
[7] ⍝ ============================================================================================
[8] ⎕USING←'System.Drawing,system.drawing.dll' 'System.Drawing.Imaging' 'Causeway,sharpplot.dll'
[9] ⎕USING,←('Causeway,sharpplot.dll')('CausewayViewer,sharpplot.dll')
[10] ⎕USING,←'System.Windows.Forms,System.Windows.Forms.dll' 'System.Drawing,System.Drawing.dll' ''
[11] ⍝ ============================================================================================
[12] sp←⎕NEW Causeway.SharpPlot(1500 1000)
[13] sp.SetFrameBackground System.Drawing.Color.Black Causeway.FillStyle.Solid 0.5
[14] sp.FrameStyle←Causeway.FrameStyles.Boxed
[15] sp.SetMargins 150 100 150 350 ⍝ top - bottom - left - righ (Randabstände)
[16] sp.Gutter←10 ⍝ Abstand Blattrand zu Rahmen
[17]
[18] sp.Heading←'Table' ⍝ Diagramm-Überschrift
[19] sp.SetHeadingNudge(0,-30) ⍝ Position der Überschrift (horizontal,vertikal)
[20] sp.SetHeadingFont'Times' 30 System.Drawing.FontStyle.Regular System.Drawing.Color.Black
[21]
[22] sp.SetAxisStyle System.Drawing.Color.Black Causeway.LineStyle.Solid 0.8
[23] sp.SetCaptionFont('Arial')(15)(System.Drawing.FontStyle.Regular)(System.Drawing.Color.Black)
[24] sp.XCaption←'X[mm]' ⍝ Title X-Axis
[25] sp.YCaption←'Y[mm]' ⍝ Title Y-Axis
[26] sp.XIntercept←0 ⍝ Schnittpunkt der X-Achse
[27] sp.YIntercept←0 ⍝ Schnittpunkt der Y-Achse
[28] sp.SetXRange(0)(15) ⍝ Scalenbereich der X-Achse (Xmin - Xmax)
[29] sp.SetYRange(0)(10) ⍝ Scalenbereich der Y-Achse (Ymin - Ymax)
[30] sp.XAxisStyle←Causeway.XAxisStyles.GridLines ⍝ X-Gitterlinien
[31] sp.YAxisStyle←Causeway.YAxisStyles.GridLines ⍝ Y-Gitterlinien
[32]
[33] sp.SetLineStyles⊂Causeway.LineStyle.(Solid)
[34] sp.SetColors⊂System.Drawing.Color.(Green)
[35] sp.SetMarkers(Marker.Cross)
[36] sp.SetMarkerScales⊂,1
[37] sp.SetPenWidths⊂,0.8
[38] sp.SetFillStyles⊂Causeway.FillStyle.(Opacity18)
[39] sp.LineGraphStyle←Causeway.LineGraphStyles.(SurfaceShading+Markers)
[40] sp.DrawLineGraph(,⊂Y1)(X1) ⍝
[41] sp.DrawLineGraph(,⊂Y2)(X2) ⍝
[42] sp.DrawLineGraph(,⊂Y3)(X3) ⍝
[43]
[44] sp.SetTablePosition(12)(10)(0)(0) ⍝ Position der Tabelle 2
[45] sp.Heading←'Coordinates'
[46] sp.SetHeadingFont'Times' 10 System.Drawing.FontStyle.Regular System.Drawing.Color.Black
[47] sp.HeadingStyle←Causeway.HeadingStyles.NoWrap
[48] sp.TableStyle←Causeway.TableStyles.Shadowed ⍝ zeichnet Schatten unter das Feld
[49] sp.XAxisStyle←Causeway.XAxisStyles.GridLines
[50] sp.YAxisStyle←Causeway.YAxisStyles.GridLines
[51] sp.ValueTagFormat←'##0.0000'
[52] sp.SetXLabels⊂,¨'X1' 'Y1' 'X2' 'Y2' 'X3' 'Y3'
[53] sp.DrawTable⊂↓⍉(X1,Y1,X2,Y2,X3,[1.5]Y3)
[54]
[55] viewer←⎕NEW SharpPlotViewer
[56] viewer.SharpPlot←sp
[57] viewer.Show ⍬
Leo
 
Posts: 38
Joined: Mon Sep 18, 2017 12:10 pm

Re: SharpPlot Table design

Postby Leo on Sun Aug 26, 2018 12:32 pm

Hello Dyalog APL user,

The first question I could solve by tasting. If you go ahead
Line [52] the command
      sp.YCaption←''

insert, the "ghost column" disappears.
Best regards
Leo
Leo
 
Posts: 38
Joined: Mon Sep 18, 2017 12:10 pm

Re: SharpPlot Table design

Postby Nicolas|Dyalog on Mon Aug 27, 2018 12:15 pm

1 - well done !
2 - use SharpPlot.SetValueFont. The documentation doesn't state this, I'll fix it.
      sp.SetValueFont'Times' 10 System.Drawing.FontStyle.Regular System.Drawing.Color.Navy

3 - use TableStyle.UseHeaders
      sp.TableStyle←Causeway.TableStyles.(Shadowed+UseHeaders)    ⍝ zeichnet Schatten unter das Feld


Cheers,

Nic.
Nicolas|Dyalog
 
Posts: 17
Joined: Wed Sep 10, 2008 9:39 am

Re: SharpPlot Table design

Postby Veli-Matti on Mon Aug 27, 2018 1:23 pm

Hi,
You could squeeze the original code a little bit (although this is strongly a personal opinion) removing redundant parens etc. Of course I couldn't resist trying to simplify the updated code...

      ForumPlotTable2;X1;X2;X3;Y1;Y2;Y3
(X1 X2 X3)←0 0.5 1+⊂⍳10
(Y1 Y2 Y3)←0.2 0.4 0.6×X1 X2 X3

⎕USING←'System.Drawing,system.drawing.dll' 'System.Drawing.Imaging' 'Causeway,sharpplot.dll'
⎕USING,←'Causeway,sharpplot.dll' 'CausewayViewer,sharpplot.dll'
⎕USING,←'System.Windows.Forms,System.Windows.Forms.dll' 'System.Drawing,System.Drawing.dll' ''

sp←⎕NEW Causeway.SharpPlot(1500 1000)
sp.SetFrameBackground System.Drawing.Color.Black Causeway.FillStyle.Solid 0.5
sp.FrameStyle←Causeway.FrameStyles.Boxed
sp.SetMargins 150 100 150 350
sp.(Gutter Heading)←10 'Table'

sp.SetHeadingNudge 0 ¯30
sp.SetHeadingFont'Times' 30,System.Drawing.(FontStyle.Regular Color.Black)
sp.SetAxisStyle System.Drawing.Color.Black Causeway.LineStyle.Solid 0.8
sp.SetCaptionFont'Arial' 15,System.Drawing.(FontStyle.Regular Color.Black)
sp.(XCaption YCaption XIntercept YIntercept)←'X[mm]' 'Y[mm]' 0 0
sp.SetXRange 0 15 ⋄ sp.SetYRange 0 10
sp.(XAxisStyle YAxisStyle)←Causeway.(XAxisStyles YAxisStyles).GridLines

sp.SetLineStyles Causeway.LineStyle.Solid
sp.SetColors System.Drawing.Color.Green
sp.SetMarkers Marker.Cross
sp.SetMarkerScales 1 ⋄ sp.SetPenWidths 0.8
sp.SetFillStyles⊂Causeway.FillStyle.Opacity18
sp.LineGraphStyle←Causeway.LineGraphStyles.(SurfaceShading+Markers)
sp.DrawLineGraph Y1 X1 ⋄ sp.DrawLineGraph Y2 X2 ⋄ sp.DrawLineGraph Y3 X3

sp.SetTablePosition 12 10 0 0
sp.SetHeadingFont'Times' 10,System.Drawing.(FontStyle.Regular Color.Black)
sp.SetValueFont'Times' 10,System.Drawing.(FontStyle.Regular Color.Navy)
sp.(HeadingStyle TableStyle)←Causeway.(HeadingStyles.NoWrap TableStyles.(Shadowed+UseHeaders))
sp.(XAxisStyle YAxisStyle)←Causeway.(XAxisStyles YAxisStyles).GridLines
sp.(Heading ValueTagFormat YCaption)←'Coordinates' '##0.0000' ''
sp.SetXLabels⊂'X1' 'Y1' 'X2' 'Y2' 'X3' 'Y3'
sp.DrawTable⊂X1 Y1 X2 Y2 X3 Y3

viewer←⎕NEW SharpPlotViewer ⋄ viewer.SharpPlot←sp ⋄ viewer.Show ⍬


WBR
-Veli-Matti
Veli-Matti
 
Posts: 93
Joined: Sat Nov 28, 2009 3:12 pm

Re: SharpPlot Table design

Postby Leo on Mon Aug 27, 2018 3:46 pm

Hello Nic and Veli-Matti,
many thanks for your help.
I realize that my scripts are always too long.
The problem is with my incomplete APL and SharpPlot understanding.
When Veli-Matti bothers to look through my code and corrected,
I am very, very grateful.
Still, APL has become my favorite activity.
Thanks again and greetings
Leo
Leo
 
Posts: 38
Joined: Mon Sep 18, 2017 12:10 pm


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest