Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Adding a text box in a scatterDraw/ScatterCtrl
Adding a text box in a scatterDraw/ScatterCtrl [message #47612] Tue, 07 February 2017 09:46 Go to next message
Giorgio is currently offline  Giorgio
Messages: 59
Registered: August 2015
Member
Hi there,
I am experimenting with ScatterDraw/ScatterCtrl. I have the need to add some kind of "text box" in a scatter. This is because I need to explain why a graph all of sudden change its behaviour. To give you some context: the graph describes the speed of a production line; usually it is almost constant, but sometimes it drops because of a breakdown of some component on the line. Is there a way to add some kind of text box?
Thanks,
Giorgio
Re: Adding a text box in a scatterDraw/ScatterCtrl [message #47613 is a reply to message #47612] Wed, 08 February 2017 08:35 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2715
Registered: August 2008
Location: Basque Country
Senior Veteran
Hi Giorgio

Do you want the text located in a specific point
- of the control (coordinates relative to the Control) or
- of the Scatter data (coordinates relative to the data plotted; if plot is scrolled or zoomed, text would be scrolled or zoomed too)


Best regards
Koldo
Re: Adding a text box in a scatterDraw/ScatterCtrl [message #47614 is a reply to message #47613] Wed, 08 February 2017 09:20 Go to previous messageGo to next message
Giorgio is currently offline  Giorgio
Messages: 59
Registered: August 2015
Member
Hi Koldo,
the latter (text located in a specific point of the Scatter data; I was actually trying to overload the DoPaint function, but it is a little bit over my knowledge.
Regards,
Giorgio
Re: Adding a text box in a scatterDraw/ScatterCtrl [message #47615 is a reply to message #47614] Wed, 08 February 2017 11:34 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2715
Registered: August 2008
Location: Basque Country
Senior Veteran
OK. I always wanted to implement an OnPaint() or WhenPaint() callback to let the user to paint things... now it is the opportunity Smile

Best regards
Koldo
Re: Adding a text box in a scatterDraw/ScatterCtrl [message #47616 is a reply to message #47615] Wed, 08 February 2017 12:02 Go to previous messageGo to next message
Giorgio is currently offline  Giorgio
Messages: 59
Registered: August 2015
Member
That's fantastic! And of course I will give any feedback / user testing required Very Happy
Re: Adding a text box in a scatterDraw/ScatterCtrl [message #47620 is a reply to message #47616] Fri, 10 February 2017 14:12 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2715
Registered: August 2008
Location: Basque Country
Senior Veteran
An advance:

index.php?t=getfile&id=5196&private=0


Best regards
Koldo
Re: Adding a text box in a scatterDraw/ScatterCtrl [message #47621 is a reply to message #47620] Fri, 10 February 2017 15:38 Go to previous messageGo to next message
Giorgio is currently offline  Giorgio
Messages: 59
Registered: August 2015
Member
Hi Koldo,
it seems really good, much beyond what I asked for; if you need some user testing just give me the new library and I will be more than happy to test it.
Regards,
Giorgio
Re: Adding a text box in a scatterDraw/ScatterCtrl [message #47622 is a reply to message #47621] Fri, 10 February 2017 23:15 Go to previous message
koldo is currently offline  koldo
Messages: 2715
Registered: August 2008
Location: Basque Country
Senior Veteran
Hi Giorgio

Sources are updated. ScatterCtrl demo includes tab17_UserPaint including it.
Provisional interface uses:
- GetPlotWidth(), GetPlotHeight() to get plot area size in pixels
- Pointf GetPosPrimary(double x, double y) 
  double GetSizeX(double cx) 		
  double GetSizeYPrimary(double cy) 	
  Pointf GetPosSecondary(double x, double y)
  double GetSizeYSecondary(double cy)
to get positions and sizes from plot units to pixel units.


As I do not know how to use templates in callbacks, it is used instead this:
	void OnPainter(Painter &w)		{OnPaint(w);}
	void OnDraw(Draw &w)			{OnPaint(w);}
	
	template <class T>
	void OnPaint(T& w) {
	...
 	}

Advice is acknowledged.


Best regards
Koldo

[Updated on: Fri, 10 February 2017 23:15]

Report message to a moderator

Previous Topic: [SOLVED] Showing elapsed time
Next Topic: Connect with an external static library
Goto Forum:
  


Current Time: Sun Apr 23 07:32:28 CEST 2017

Total time taken to generate the page: 0.02645 seconds