Threading SharpPlot

General APL language issues

Threading SharpPlot

Postby paulmansour on Wed Dec 27, 2023 3:33 am

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:

      ⎕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: 430
Joined: Fri Oct 03, 2008 4:14 pm

Re: Threading SharpPlot

Postby Adam|Dyalog on Sun Dec 31, 2023 3:17 pm

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.
User avatar
Adam|Dyalog
 
Posts: 143
Joined: Thu Jun 25, 2015 1:13 pm

Re: Threading SharpPlot

Postby paulmansour on Tue Jan 02, 2024 7:06 am

If the Chart wizard runs in its own thread, wouldn't that be a 2 instead of a 1 below?

      )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: 430
Joined: Fri Oct 03, 2008 4:14 pm

Re: Threading SharpPlot

Postby Adam|Dyalog on Tue Jan 02, 2024 7:30 am

You're right. I completely forgot that it is a GUI app.

Sorry for the noise.
User avatar
Adam|Dyalog
 
Posts: 143
Joined: Thu Jun 25, 2015 1:13 pm

Re: Threading SharpPlot

Postby paulmansour on Tue Jan 02, 2024 3:53 pm

No problem. There is definitely something wrong with the SharpPlot dll and threading... but I haven't figured out exactly what yet...
paulmansour
 
Posts: 430
Joined: Fri Oct 03, 2008 4:14 pm

Re: Threading SharpPlot

Postby Vince|Dyalog on Thu Jan 04, 2024 11:10 am

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
Vince|Dyalog
 
Posts: 432
Joined: Wed Oct 01, 2008 9:39 am

Re: Threading SharpPlot

Postby JoHo on Thu Jan 04, 2024 4:24 pm

I think the word for the 2006 release notes is: thread-safe.
SCNR
User avatar
JoHo
 
Posts: 37
Joined: Sat Nov 28, 2009 12:51 pm
Location: Austria, EU


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest