SharpPlot tables

General APL language issues

SharpPlot tables

Postby Leo on Tue Jan 19, 2021 2:36 pm

Hello APL and SharpPlot users,
I am in the process of creating a SharpPlot file, which will serve as a template for creating SharpPlot tables.

On the basis of the attached file (which is running) I ask you for help to clarify the following questions:

1. How do remove I the first column with the terms "North" "South" "East" "West" ...?

2. What must the command be so that the term "Coordinates" appears as a heading above the left margin of the right table?

1. What is the command so that the numbers in the tables appear in different colors?

Thank you for your help!

many Greetings
Leo
      ∇MyTable[⎕]∇
[0] sp←MyTable;Causeway;System;Column1;Column2;Column3;XLabel;YLabel;XLab;LN;X;Y1;Y2
[1] ⍝ MyTable2: Erstellen einer Tabelle 15.01.2021 Ju
[2] ⍝ Daten für Tabelle1: ================================================================
[3] Column1←18 27 31 1 1
[4] Column2←120 34 27 18 8
[5] Column3←69 30 9 4 8
[6] YLabel←'North' 'South' 'East' 'West' 'Other'
[7] XLabel←2004 2005 2006
[8] ⍝
[9] ⍝ Daten für Tabelle 2: ==============================================================
[10] X←0 0.01 0.02 0.05 0.1 0.25 0.5 0.6 0.7 0.8 0.9 1
[11] Y1←0 0.0307 0.0411 0.0579 0.0699 0.074 0.0552 0.0456 0.0367 0.0292 0.0229 0.0176
[12] Y2←0 ¯0.0307 ¯0.0411 ¯0.0579 ¯0.0699 ¯0.074 ¯0.0552 ¯0.0456 ¯0.0367 ¯0.0292 ¯0.0229 ¯0.0176
[13] LN←⍳⍴X
[14] ⍝
[15] ⍝ ======================================================================================
[16] ⎕USING←'System.Drawing,system.drawing.dll' 'System.Drawing.Imaging' 'Causeway,sharpplot.dll'
[17] ⎕USING,←('Causeway,sharpplot.dll')('CausewayViewer,sharpplot.dll')
[18] ⎕USING,←'System.Windows.Forms,System.Windows.Forms.dll' 'System.Drawing,System.Drawing.dll' ''
[19] ⍝ ======================================================================================
[20] sp←⎕NEW Causeway.SharpPlot(740 520) ⍝ PaperSize in Pixel
[21] sp.Gutter←10 ⍝ Abstand des äußeren Rahmens vom Blattrand in Pixel
[22] ⍝
[23] ⍝ Heading =========================================================================
[24] sp.Heading←'MyTable' ⍝ Überschrift des Diagrammes
[25] sp.SetHeadingNudge(0,-30) ⍝ Position der Überschrift (horizont. 0=Mitte, Diagramm ,vertikal)
[26] sp.SetHeadingFont'Calibri' 30 System.Drawing.FontStyle.Regular System.Drawing.Color.Black
[27] ⍝
[28] ⍝ Subheating ====================================================================
[29] sp.Subheading←'Beispiele zur Erstellung von Tabellen mit SharpPlot' ⍝ Unter-Überschrift
[30] sp.SetSubheadingFont'Arial' 20 System.Drawing.FontStyle.Regular System.Drawing.Color.Black
[31] ⍝
[32] ⍝ Hintergrund ====================================================================
[33] sp.SetBackground System.Drawing.Color.Yellow Causeway.FillStyle.Solid ⍝ Hintergrundfarbe (außerhalb Tabelle)
[34] ⍝
[35] ⍝ Table 1 =======================================================================
[36] sp.TableStyle←Causeway.TableStyles.(Shadowed+GridLines+Right+Rounded) ⍝ Stil und Position der Tabelle
[37] sp.SetTablePosition(300)(260)(300)(0) ⍝ Position der Tabelle 2 X-Y Breite Höhe
[38] sp.YCaption←'Regional\Totals' ⍝ Überschrift in Zeile1 und Spalte 1
[39] sp.SetLabelFont'Times' 7 System.Drawing.FontStyle.Regular System.Drawing.Color.Black ⍝ Schriftstil von farm und ye
ar
[40] sp.SetCaptionFont'Arial' 6 System.Drawing.FontStyle.Bold System.Drawing.Color.Red ⍝ Schriftstil von 'Mean Yield'
[41] sp.SetXLabels⊂XLabel
[42] sp.SetYLabels⊂YLabel
[43] sp.DrawTable⊂2 3 3⍕¨¨Column1 Column2 Column3 ⍝ Formatierung der Zahlenwerte in den Spalten
[44] ⍝
[45] ⍝ Table 2 =======================================================================
[46] sp.TableStyle←Causeway.TableStyles.(Shadowed+GridLines+Right) ⍝ Stil und Position der Tabelle
[47] sp.SetTablePosition(400)(260)(200)(0) ⍝ Position der Tabelle 2 X, Y, Breite, Höhe
[48] sp.SetHeadingFont'Calibri' 10 System.Drawing.FontStyle.Regular System.Drawing.Color.Navy
[49] sp.SetColors System.Drawing.Color.Black
[50] ⍝ sp.(HeadingStyle TableStyle)←Causeway.(HeadingStyles.NoWrap TableStyles.(Shadowed+UseHeaders))
[51] sp.(XAxisStyle YAxisStyle)←Causeway.(XAxisStyles YAxisStyles).GridLines
[52] sp.(Heading YCaption)←'Coordinates' '' ⍝ Unterdrückt die "Geisterspalte"
[53] sp.(HeadingStyle TableStyle)←Causeway.(HeadingStyles.NoWrap TableStyles.(Shadowed))
[54] sp.SetXLabels⊂,¨('LN' 'X[ - ]' 'Y1[ - ]' 'Y2[ - ]') ⍝ Spaltenüberschrift
[55] sp.DrawTable⊂0 3 3 3⍕¨¨LN X Y1 Y2 ⍝ Formatierung der Tabellen-Werte
[56] ⍝
[57] ⍝ Output =============================================================================
[58] sp.SavePdf⊂'C:\Users\Admin\Desktop\MyTable.pdf' ⍝ pdf-Graphik
[59] ⍝ -Graphic on screen show-------------------------------------------------------------
[60] viewer←⎕NEW SharpPlotViewer ⋄ viewer.SharpPlot←sp ⋄ viewer.Show ⍬ ⍝ Screen-Graphik
[61] ⍝ ======================================================================================
[62] 'MyTable'
Leo
 
Posts: 38
Joined: Mon Sep 18, 2017 12:10 pm

Re: SharpPlot tables

Postby Nicolas|Dyalog on Mon Feb 08, 2021 8:19 am

1. To disable YLabels, do :
      sp.SetYLabels⊂0⍴⊂''

You need to do this explicitly in the second table, because it was set for the first table (remember SharpPlot is a state machine).

2. Replace lines [52] and [53] with:
      sp.(Heading YCaption Subheading)←'Coordinates' '' ''
sp.(HeadingStyle TableStyle)←Causeway.(HeadingStyles.(NoWrap+Left)TableStyles.(Shadowed+UseHeaders))


3. Cells may only use one single colour. You can change it with SetValueFont
      sp.SetValueFont'Arial' 6 System.Drawing.FontStyle.Bold System.Drawing.Color.Navy

(see https://sharpplot.com/SharpPlot-DrawTable.htm )

Cheers,

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

Re: SharpPlot tables

Postby Leo on Tue Feb 16, 2021 4:13 pm

Hello Nic,
Thank you for your help!

In the meantime, with the help of you and the forum, I have succeeded in writing two “cookbook” programs that cover around 80% of my needs. My problem with SharpPlot is
that I can only incompletely translate the C code, which is documented in detail in the user manual, to DyalogAPL. Still, I think SharpPlot is a good program.

If Dyalog has a helpful link for translating from C to APL that helps with programming, I would be a grateful customer.

Many greetings
Leo
Leo
 
Posts: 38
Joined: Mon Sep 18, 2017 12:10 pm

Re: SharpPlot tables

Postby Vince|Dyalog on Tue Feb 16, 2021 4:38 pm

Hi Leo,

For translating SharpPlot docs C# to APL:

You can ask here, or email us at Dyalog Support with what you have so far and what you are trying to do.

I find looking at a combination of our .NET Interface Guide and user posts in the Forums helpful for writing .NET APL code.

Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest