Threading SharpPlot
7 posts
• Page 1 of 1
Threading SharpPlot
Hello all, and Merry Christmas!
I'm having some trouble multithreading SharpPlot. It appears to really not like operating in a thread. My stuff just hangs the interpreter. I also notice that while this works:
this does not:
Though it does not hang the interpreter.
Worse though is that it is not consistent. Some time it works, sometime it doesn't.
Before I spend hours trying to get a consistent, simple repro, anyone have any ideas or thoughts?
I'm having some trouble multithreading SharpPlot. It appears to really not like operating in a thread. My stuff just hangs the interpreter. I also notice that while this works:
⎕SE.UCMD 'Chart ⍳10'
this does not:
⎕SE.UCMD &'Chart ⍳10'
Though it does not hang the interpreter.
Worse though is that it is not consistent. Some time it works, sometime it doesn't.
Before I spend hours trying to get a consistent, simple repro, anyone have any ideas or thoughts?
- paulmansour
- Posts: 429
- Joined: Fri Oct 03, 2008 4:14 pm
Re: Threading SharpPlot
It should be noted that the chart wizard already runs in its own thread, so you can use ]chart twice to work on two different charts simultaneously, while the session is free for use too.
-
Adam|Dyalog - Posts: 143
- Joined: Thu Jun 25, 2015 1:13 pm
Re: Threading SharpPlot
If the Chart wizard runs in its own thread, wouldn't that be a 2 instead of a 1 below?
In addition, there is no need to use multi-threading to have multiple instances of a GUI app running in a single interpreter, and still have access to session, so not sure why it would be implemented like that, but I don't see how it could be anyway given the above output. And there does not appear to be an ampersand anywhere in the 6,973 lines of the chart wizard script.
)reset
]Chart ⍳10
+{}&0
1
In addition, there is no need to use multi-threading to have multiple instances of a GUI app running in a single interpreter, and still have access to session, so not sure why it would be implemented like that, but I don't see how it could be anyway given the above output. And there does not appear to be an ampersand anywhere in the 6,973 lines of the chart wizard script.
- paulmansour
- Posts: 429
- Joined: Fri Oct 03, 2008 4:14 pm
Re: Threading SharpPlot
You're right. I completely forgot that it is a GUI app.
Sorry for the noise.
Sorry for the noise.
-
Adam|Dyalog - Posts: 143
- Joined: Thu Jun 25, 2015 1:13 pm
Re: Threading SharpPlot
No problem. There is definitely something wrong with the SharpPlot dll and threading... but I haven't figured out exactly what yet...
- paulmansour
- Posts: 429
- Joined: Fri Oct 03, 2008 4:14 pm
Re: Threading SharpPlot
Hi Paul,
I think SharpPlot is intended to work in multiple threads as it said this in the release notes in 2006: "Multi-threading - in some cases it was possible for two instances of SharpPlot to interfere
when running on the same process in different threads. This has now been fixed."
Also, you can look at the script in the chart wizard. This might help remove some moving parts by eliminating the use of UCMD (user commands).
This is the script that I see if I start with ]chart ⍳10 and then look at File->View Script.
⍝ Global page set-up
⎕USING←',sharpplot.dll' ',system.drawing.dll' ⍝ you probably want to localise ⎕USING
⍝ To use cross-platform SharpPlot, comment the above and un-comment below
⍝ :If 0=⎕NC'Causeway' ⋄ (System.Drawing←System←⍎'Causeway'⎕NS'').(⎕CY'sharpplot') ⋄ :EndIf ⍝ workspace copied only once if Causeway and System are not localised
sp←⎕NEW Causeway.SharpPlot
⍝ Chart1 (Bar)
sp.BarChartStyle←Causeway.BarChartStyles.TicksBetween
sp.BarLimit←10000
sp.XAxisStyle←Causeway.XAxisStyles.(AngledLabels+MiddleLabels)
sp.YAxisStyle←Causeway.YAxisStyles.(ForceZero+GridLines)
sp.DrawBarChart ⊂,⊂⍳10
⍝ (⎕NEW Causeway.SharpPlotViewer sp).Show ⍬ ⍝ Uncomment this line to view the chart (Windows IDE)
⍝ 3500⌶sp.RenderSvg Causeway.SvgMode.FixedAspect ⍝ Uncomment this line to view the chart (RIDE)
Regards,
Vince
I think SharpPlot is intended to work in multiple threads as it said this in the release notes in 2006: "Multi-threading - in some cases it was possible for two instances of SharpPlot to interfere
when running on the same process in different threads. This has now been fixed."
Also, you can look at the script in the chart wizard. This might help remove some moving parts by eliminating the use of UCMD (user commands).
This is the script that I see if I start with ]chart ⍳10 and then look at File->View Script.
⍝ Global page set-up
⎕USING←',sharpplot.dll' ',system.drawing.dll' ⍝ you probably want to localise ⎕USING
⍝ To use cross-platform SharpPlot, comment the above and un-comment below
⍝ :If 0=⎕NC'Causeway' ⋄ (System.Drawing←System←⍎'Causeway'⎕NS'').(⎕CY'sharpplot') ⋄ :EndIf ⍝ workspace copied only once if Causeway and System are not localised
sp←⎕NEW Causeway.SharpPlot
⍝ Chart1 (Bar)
sp.BarChartStyle←Causeway.BarChartStyles.TicksBetween
sp.BarLimit←10000
sp.XAxisStyle←Causeway.XAxisStyles.(AngledLabels+MiddleLabels)
sp.YAxisStyle←Causeway.YAxisStyles.(ForceZero+GridLines)
sp.DrawBarChart ⊂,⊂⍳10
⍝ (⎕NEW Causeway.SharpPlotViewer sp).Show ⍬ ⍝ Uncomment this line to view the chart (Windows IDE)
⍝ 3500⌶sp.RenderSvg Causeway.SvgMode.FixedAspect ⍝ Uncomment this line to view the chart (RIDE)
Regards,
Vince
- Vince|Dyalog
- Posts: 432
- Joined: Wed Oct 01, 2008 9:39 am
Re: Threading SharpPlot
I think the word for the 2006 release notes is: thread-safe.
SCNR
SCNR
-
JoHo - Posts: 37
- Joined: Sat Nov 28, 2009 12:51 pm
- Location: Austria, EU
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group