SharpPlot example by Nicolas Delcros
5 posts
• Page 1 of 1
SharpPlot example by Nicolas Delcros
Version: 16.0.31693.0 64 Unicode
Created: Dec 3 2017 at 19:58:11
Windows 7
Hello DyalogAPL'er
The SharpPlot example by Nicolas Delcros
ends with the following errors:
For this feature and for SharpPlot programming following questions:
1. What are the lines for
2. What should the two lines look like for the above function to run without errors?
3. Is there any description for the implementation of SharpPlot - C # in SharpPlot - DyalogAPL Commands?
4. How must e.g. the C # command
Many thanks in advance for your help!
Leo
Created: Dec 3 2017 at 19:58:11
Windows 7
Hello DyalogAPL'er
The SharpPlot example by Nicolas Delcros
NicolasExample
⍝ Quelle: Nicolas Delcros-Dyalog'17-Hesingor
⍝ 1. Set Frame
⎕USING←',sharpplot.dll' ',system.drawing.dll'
sp←⎕NEW Causeway.SharpPlot(800 600)
⍝ 2. Set Parameters
sp.Heading←'My Chart'
sp.LineGraphStyle←Causeway.LineGraphStyles.GridLines
⍝ 3. Draw
data←+\¯40+?100⍴100
sp.DrawLineGraph⊂data
⍝ 4. Output(to file or stream)
System.Drawing.Imaging.ImageFormat.Png
sp.SaveImage'D:\mychart.png'[aplcode]
ends with the following errors:
Png
LENGTH ERROR
NicolasExample[18] sp.SaveImage'D:\mychart.png'
∧
For this feature and for SharpPlot programming following questions:
1. What are the lines for
System.Drawing.Imaging.ImageFormat.Png
sp.SaveImage'D:\mychart.png'
2. What should the two lines look like for the above function to run without errors?
3. Is there any description for the implementation of SharpPlot - C # in SharpPlot - DyalogAPL Commands?
4. How must e.g. the C # command
sp = new SharpPlot (PaperSize.Landscape (PaperSize.A5));be rewritten for DyalogAPL?
Many thanks in advance for your help!
Leo
- Leo
- Posts: 38
- Joined: Mon Sep 18, 2017 12:10 pm
Re: SharpPlot example by Nicolas Delcros
Hi Leo,
I believe the code should look like this:
(I had to change the output file name to get it to work on my laptop).
To answer your other questions:
I believe the code should look like this:
- Code: Select all
NicolasExample;data;sp;⎕USING
⍝ Quelle: Nicolas Delcros-Dyalog'17-Hesingor
⍝ 1. Set Frame
⎕USING←',sharpplot.dll' ',system.drawing.dll'
sp←⎕NEW Causeway.SharpPlot(800 600)
⍝ 2. Set Parameters
sp.Heading←'My Chart'
sp.LineGraphStyle←Causeway.LineGraphStyles.GridLines
⍝ 3. Draw
data←+\¯40+?100⍴100
sp.DrawLineGraph⊂data
⍝ 4. Output(to file or stream)
sp.SaveImage 'c:\temp\mychart.png' System.Drawing.Imaging.ImageFormat.Png
(I had to change the output file name to get it to work on my laptop).
To answer your other questions:
- 1. (and 2:) These two lines should have been a single line, the last one above.
- Code: Select all
sp←⎕NEW SharpPlot (PaperSize.Landscape PaperSize.A5)
3. Not able to answer this right now, we'll have to wait for Nic.
4. ⎕NEW takes a 2-element vector as its right argument, a reference to a class and an array containing the constructor arguments:
-
Morten|Dyalog - Posts: 462
- Joined: Tue Sep 09, 2008 3:52 pm
Re: SharpPlot example by Nicolas Delcros
Version: 16.0.31693.0 64 Unicode
Created: Dec 3 2017 at 19:58:11
Windows 7
Hello Mr. Morton,
Thank you for the fast answer. She helped me a lot in SharpPlot.
The below modified - "NicolasExample" function is executable. The calculation result is written to the file (c: \ temp \ NicolasExample.png) and displayed on the screen at the same time.
But here are some more questions:
1. When I attempting to activate paper size with line [9] (line [8] is inactive), the function ends with a LENGTH ERROR.
2. What must the output command look like in the above function to write the graphic in .pdf format to a file?
3. The output file can not be written to another disk partition (eg to D: \ tmp \ NicolasExample.png). Is there a reason for this?
Many thanks for the help and many greetings!
Leo
Created: Dec 3 2017 at 19:58:11
Windows 7
Hello Mr. Morton,
Thank you for the fast answer. She helped me a lot in SharpPlot.
The below modified - "NicolasExample" function is executable. The calculation result is written to the file (c: \ temp \ NicolasExample.png) and displayed on the screen at the same time.
∇ NicolasExample;dat;sp;⎕USING
[1] ⍝ Quelle: Nicolas Delcros-Dyalog'17-Hesingor
[2]
[3] ⍝ 1. Set Frame
[4] ⎕USING←',sharpplot.dll' ',system.drawing.dll' ⍝ ⎕USING: Aufruf der .NET-Suchpfade für sp-Namespaces
[5] ⎕USING,←('Causeway,sharpplot.dll')('CausewayViewer,sharpplot.dll')
[6] ⎕USING,←'System.Windows.Forms,System.Windows.Forms.dll' 'System.Drawing,System.Drawing.dll' ''
[7]
[8] sp←⎕NEW Causeway.SharpPlot(800 600)
[9] ⍝ sp←⎕NEW SharpPlot(PaperSize.Landscape PaperSize.A7)
[10]
[11] ⍝ 2. Set Parameters
[12] sp.Heading←'NicolasExample'
[13] sp.LineGraphStyle←Causeway.LineGraphStyles.GridLines
[14]
[15] ⍝ 3. Draw
[16] data←+\¯40+?100⍴100
[17] sp.DrawLineGraph⊂data
[18]
[19] ⍝ 4. Output
[20] ⍝ 4.1 Graphic in Datei schreiben
[21] sp.SaveImage'c:\temp\NicolasExample.png'System.Drawing.Imaging.ImageFormat.Png
[22]
[23] ⍝ 4.2 Graphic auf Bildschirm
[24] viewer←⎕NEW SharpPlotViewer
[25] viewer.SharpPlot←sp
[26] viewer.Show ⍬
∇
But here are some more questions:
1. When I attempting to activate paper size with line [9] (line [8] is inactive), the function ends with a LENGTH ERROR.
[9] sp←⎕NEW SharpPlot(PaperSize.Landscape PaperSize.A7)Why?
LENGTH ERROR
2. What must the output command look like in the above function to write the graphic in .pdf format to a file?
3. The output file can not be written to another disk partition (eg to D: \ tmp \ NicolasExample.png). Is there a reason for this?
Many thanks for the help and many greetings!
Leo
- Leo
- Posts: 38
- Joined: Mon Sep 18, 2017 12:10 pm
Re: SharpPlot example by Nicolas Delcros
Hi Leo, sorry for the slow response, had a busy couple of days!
1. I missed the fact that PaperSize.Landscape is a function... You need to pass A7 as an argument to it:
2. Can you try:
3. I can't think of a reason for this... I see you have spaces in the file in your post, that probably isn't a good idea?
Morten
1. I missed the fact that PaperSize.Landscape is a function... You need to pass A7 as an argument to it:
- Code: Select all
sp←⎕NEW SharpPlot (PaperSize.Landscape ⊂PaperSize.A7)
2. Can you try:
- Code: Select all
sp.SavePdf ⊂'c:\temp\NicolasExample.pdf'
3. I can't think of a reason for this... I see you have spaces in the file in your post, that probably isn't a good idea?
Morten
-
Morten|Dyalog - Posts: 462
- Joined: Tue Sep 09, 2008 3:52 pm
Re: SharpPlot example by Nicolas Delcros
Thank you Mr. Morton!
Thanks to your help, the NicolasExample now works fine.
I have it in this State put in the forum. Maybe can someone may need it.
Many greetings!
Leo
Thanks to your help, the NicolasExample now works fine.
I have it in this State put in the forum. Maybe can someone may need it.
∇ NicolasExample;dat;sp;⎕USING
[1] ⍝ Quelle: Nicolas Delcros-Dyalog'17-Hesingor
[2] ⍝
[3] ⍝ 1. Set Frame
[4] ⎕USING←',sharpplot.dll' ',system.drawing.dll' ⍝ ⎕USING: Aufruf der .NET-Suchpfade für sp-Namespaces
[5] ⎕USING,←('Causeway,sharpplot.dll')('CausewayViewer,sharpplot.dll')
[6] ⎕USING,←'System.Windows.Forms,System.Windows.Forms.dll' 'System.Drawing,System.Drawing.dll' ''
[7] ⍝
[8] ⍝ sp←⎕NEW Causeway.SharpPlot(800 600) default version
[9] sp←⎕NEW SharpPlot(PaperSize.Landscape⊂PaperSize.A7)
[10] ⍝ 2. Set Parameters
[11] sp.Heading←'NicolasExample'
[12] sp.LineGraphStyle←Causeway.LineGraphStyles.GridLines
[13] ⍝ 3. Draw
[14] data←+\¯40+?100⍴100
[15] sp.DrawLineGraph⊂data
[16] ⍝ 4. Output
[17] ⍝ 4.1 Graphic in *.png - write file
[18] sp.SaveImage'c:\temp\NicolasExample.png'System.Drawing.Imaging.ImageFormat.Png
[19] ⍝ 4.2 Graphic in *.pdf - write file
[20] sp.SavePdf⊂'c:\temp\NicolasExample.pdf'
[21] ⍝ 4.3 Graphic on screen show
[22] viewer←⎕NEW SharpPlotViewer
[23] viewer.SharpPlot←sp
[24] viewer.Show ⍬
[25] ⍝
∇
Many greetings!
Leo
- Leo
- Posts: 38
- Joined: Mon Sep 18, 2017 12:10 pm
5 posts
• Page 1 of 1
Return to Functional Programming
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group