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 » U++ community news and announcements » New graph packages
New graph packages [message #35124] Sun, 15 January 2012 09:45 Go to next message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello all

There are four new packages in Sandbox to draw Scatter and series graphs in general. They are:
- ScatterDraw: Basic class
- ScatterDraw_demo: Demo of headless drawing for console applications.
- ScatterCtrl: Control
- ScatterCtrl_demo: Different series graph demos.

They combine ScatterCtrl and PlotCtrl/PlotLib features, plus some additional things, like they admit:
- Any kind of data sources through DataSource class
- User defined graph and mark functions

Please test them hard. They are intended to be included in main U++ Smile.


Best regards
Iñaki
Re: New graph packages [message #35142 is a reply to message #35124] Mon, 16 January 2012 22:22 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi Koldo,

Does it mean that bar or stacked bar graphs will be available as in wxFreeChart library?

Kind regards
Biobytes
Re: New graph packages [message #35144 is a reply to message #35142] Mon, 16 January 2012 23:24 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello BioBytes

ScatterDraw package is rather flexible so it can admit many possible new graphs.

If a new graph makes sense for you, just do it or ask for it Smile.

The sooner the better, because now the programming interface is opened in the case a new graph would require to modify it.

And if you know a better simpler way to describe a new graph, just describe it.


Best regards
Iñaki
Re: New graph packages [message #35192 is a reply to message #35144] Sat, 21 January 2012 12:18 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 690
Registered: November 2008
Location: France
Contributor
Hi Koldo,

this sounds great but unfortunently, you're test project compiles OK but does not execute: the static part gives a X11 error
==4445== Invalid read of size 4
==4445==    at 0x69EB1B6: XInternAtom (in /usr/lib/libX11.so.6.3.0)
==4445==    by 0x8191FDB: Upp::XAtomRaw(char const*) (X11App.cpp:15)
==4445==    by 0x81920EA: Upp::XAtom(char const*) (X11App.cpp:26)
==4445==    by 0x8187B92: Upp::Ctrl::IsCompositedGui() (X11Wnd.cpp:662)
==4445==    by 0x8167695: Upp::Ctrl::Ctrl() (Ctrl.cpp:560)
==4445==    by 0x80A3DD4: Upp::ParentCtrl::ParentCtrl() (Static.cpp:202)
==4445==    by 0x80532DE: ScatterDemo::ScatterDemo() (ScatterCtrl_Demo.h:16)
==4445==    by 0x80607C4: WithTab10<ScatterDemo>::WithTab10() (ScatterCtrl_Demo.lay:62)
==4445==    by 0x806089C: Tab10::Tab10() (ScatterCtrl_Demo.h:153)
==4445==    by 0x806001F: s__s69_fn() (tab10.cpp:70)
==4445==    by 0x805223C: Upp::Callinit::Callinit(void (*)(), char const*, int) (Defs.h:169)
==4445==    by 0x806014D: __static_initialization_and_destruction_0(int, int) (tab10.cpp:69)
==4445==  Address 0x4d0 is not stack'd, malloc'd or (recently) free'd


I am under linux with gcc (GCC) 4.4.4 20100630 (Red Hat 4.4.4-10)

I have full Upp up to date and Ide freshly compiled

I'm looking into it

Didier
Re: New graph packages [message #35198 is a reply to message #35192] Sat, 21 January 2012 21:29 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello Didier

I understand. The problem is that I constructed a Ctrl inside an INITBLOCK()...

Now inside the INITBLOCK() there will be only a function call Smile.


Best regards
Iñaki
Re: New graph packages [message #35201 is a reply to message #35198] Sat, 21 January 2012 23:27 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Solved.

Best regards
Iñaki
Re: New graph packages [message #35206 is a reply to message #35201] Sun, 22 January 2012 11:21 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 690
Registered: November 2008
Location: France
Contributor
Hi Koldo,

Thank's !

Looking at the recent posts, I new it was something like that.

Dideir
Re: New graph packages [message #35216 is a reply to message #35206] Mon, 23 January 2012 09:39 Go to previous messageGo to next message
ratah is currently offline  ratah
Messages: 107
Registered: July 2010
Experienced Member
Hello Koldo,

I'd like to try the new graph packages but I don't have access to the last nightly built u++ (windows version).
The last one in http://code.google.com/p/upp-mirror/downloads/list is 6 days old.

Best regards,

Ratah

[Updated on: Mon, 23 January 2012 09:39]

Report message to a moderator

Re: New graph packages [message #35221 is a reply to message #35216] Mon, 23 January 2012 19:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Demo looks good.

In Basic Test, there are two strange issues: In non-antialiased mode, bottom x line is missing. And there is quite big color difference between Draw and Painter - but perhaps it is because with Painter, there is some form of Color mixing? (I have not studied the code yet..)
Re: New graph packages [message #35222 is a reply to message #35221] Mon, 23 January 2012 19:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
I have fixed some GCC4.5 warnings, except:

/home/cxl/sandbox/ScatterDraw/ScatterDraw.cpp:1028:9: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]

perhaps you might want to check the code.

Note: the main change was moving most of member initializations to the constructor body - the reason is that GCC complains a lot if the order of these initializations differs from the order of declarations in class.
Re: New graph packages [message #35225 is a reply to message #35222] Mon, 23 January 2012 22:38 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello Mirek

Thank you for the fixes Smile. I have fixed the "start" warning too. I do not know why the initializations order is so important for GCC... Anyway soon I expect to have an efficient Linux with GCC 4.6. Now I have a good Ubuntu 10.04 but the latest goes through VirtualBox and it works terribly slow.

Quote:

In Basic Test, there are two strange issues: In non-antialiased mode, bottom x line is missing. And there is quite big color difference between Draw and Painter - but perhaps it is because with Painter, there is some form of Color mixing? (I have not studied the code yet..)


In non-antialiased mode also texts almost disappear. I am not sure if I am doing it right to get the best quality. I move 0.5 in X and Y to get nice thin lines in integer positions.

About color background, the explanation is easy: ScatterDraw supports opacity but... with the ScatterDraw background. Painter manages opacity of all overlapping items, but ScatterDraw Draw version only handles opacity with Ctrl background. Look that the blue background looks the same for all versions.

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

In addition line opacity was removed as it was a problem to handle the opacity of the line with its own background.
  • Attachment: dib.PNG
    (Size: 31.38KB, Downloaded 1461 times)


Best regards
Iñaki

[Updated on: Tue, 24 January 2012 08:45] by Moderator

Report message to a moderator

Re: New graph packages [message #35230 is a reply to message #35124] Tue, 24 January 2012 08:48 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
Quote:

I do not know why the initializations order is so important for GCC...


IIRC according to C++ standard definition the order of init is either implementation specific or as-defined.
So the order you write inits in the source is not used, and in case some of your init is order depended, this may lead to bugs which are quite difficult to find.

As long as you write the initializers in the as-defined order, you can see such mistake "visually" in case you use some of the variables before it is initialized on the later position.
Re: New graph packages [message #35343 is a reply to message #35230] Fri, 03 February 2012 18:22 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 690
Registered: November 2008
Location: France
Contributor
Hi Koldo,

There is a small bug in ScatterCtrl (also present in Scatter):
When 'SetMajorUnitsNum(xx,yy);' is not called, the ctrl can freeze in very very long loop while truing to adjust y2 unit.

If you add
SetMajorUnitsNum(10,10);
in the constructor of 'ScatterDraw', this bug is prevented.

NB: I am currently trying to enhance grid recalculation according to zoom, so that the grid does not end up filling the whole paint zone when zooming out real far !
I intend to use the same adjustement technique than the one used in PlotCtrl
Re: New graph packages [message #35345 is a reply to message #35343] Fri, 03 February 2012 19:53 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello Didier

Ok. Added.

Quote:

NB: I am currently trying to enhance grid recalculation according to zoom, so that the grid does not end up filling the whole paint zone when zooming out real far !
I intend to use the same adjustment technique than the one used in PlotCtrl
Perfect, although be careful of avoiding to paint lines that go to points outside viewed window.


Best regards
Iñaki
Re: New graph packages [message #35346 is a reply to message #35345] Sat, 04 February 2012 00:11 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello Didier

Also do not forget that SetSequentialX() only paints visible zoom.


Best regards
Iñaki
Re: New graph packages [message #35456 is a reply to message #35346] Sat, 18 February 2012 21:15 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello Didier, Honza and all

Any new comments?.

Please include (Didier) your proposal of new functions, changed function names.



Best regards
Iñaki
Re: New graph packages [message #35458 is a reply to message #35456] Sun, 19 February 2012 13:30 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 690
Registered: November 2008
Location: France
Contributor
Hi Koldo,

I've just comme back from vacation and I'm gonna go back to my modifications.

Il post them when finished

Re: New graph packages [message #35601 is a reply to message #35458] Sat, 03 March 2012 21:56 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello all

After a month and a half after including new graph packages I will do the next steps:

- Review coding style to be more like standard U++
- Extract DataSource to a new parallel package
- Include the documentation

If you have proposals specially if they affect the external interface, please post them ASAP.

Mirek: In addition if there is anything that you do not like from these packages or you have any proposal please post it ASAP too.


Best regards
Iñaki
Re: New graph packages [message #35603 is a reply to message #35601] Sun, 04 March 2012 13:48 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 690
Registered: November 2008
Location: France
Contributor
Hi Koldo,

I think DataSource used in ScatterDraw should go template:

The only reason for this is to enable high performance if needed:
class DataSource {
public:
	typedef double (DataSource::*Getdatafun)(int id);

	DataSource() : isParam(false) {}
	virtual ~DataSource() {};	
	virtual double z(int id) 	{return Null;};
	virtual double y(int id) 	{return Null;};
	virtual double x(int id) 	{return Null;};
	virtual int GetCount()		{return Null;};
	bool IsParam()				{return isParam;};

	virtual double MinX() {return Min(&DataSource::x);}	
	virtual double MinY() {return Min(&DataSource::y);}	
	virtual double MinZ() {return Min(&DataSource::z);}	

	virtual double MaxX() {return Max(&DataSource::x);}				
	virtual double MaxY() {return Max(&DataSource::y);}	
	virtual double MaxZ() {return Max(&DataSource::z);}	

	virtual double AvgX() {return Avg(&DataSource::x);}	
	virtual double AvgY() {return Avg(&DataSource::y);}					
	virtual double AvgZ() {return Avg(&DataSource::z);}	


Class DataSource is a pure virtual class
==> so all method calls need to go by the virtual table ==> poor performance
This is specially true for the x,y,z methods which get called for each point drawn.

If Scatter Draw had was defined the following way:
template<class DATASOURCE = DataSource>
class ScatterDraw {
public:
...


The following high performance trivial class could be used intead:
template<int NBPOINTS>
class DataSource {
private:
	double _x[NBPOINTS];
	double _y[NBPOINTS];
	double _z[NBPOINTS];
public:

DataSource() {}
inline double z(int id) 	{return _x[id];}
inline double y(int id) 	{return _y[id];}
inline double x(int id) 	{return _z[id];}
inline int GetCount()		{return NBPOINTS;}
inline bool IsParam()		{return false;}

inline double MinX() {return ....;}	
inline double MinY() {return ....;}	
inline double MinZ() {return ....;}	

inline double MaxX() {return ....;}				
inline double MaxY() {return ....;}	
inline double MaxZ() {return ....;}	

inline double AvgX() {return ....;}	
inline double AvgY() {return ....;}					
inline double AvgZ() {return ....;}	
};


The backdraw to this is that most of ScatterDraw should go in the header
But after all that is not such a big issue.

NB: I know that most of the performance is due to drawing speed but all enhancements are welcome I think

What do you think ?

[Updated on: Sun, 04 March 2012 14:42]

Report message to a moderator

Re: New graph packages [message #35604 is a reply to message #35603] Sun, 04 March 2012 15:05 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello Didier

Sorry. I do not understand you well Smile. DataSource class do not keep any data. It is just an interface to other classes.

About going template I did a first try... unsuccessful. If you feel you can get it and it is an advantage, and you can help, it would be great.


Best regards
Iñaki
Previous Topic: New pick/clone notation now merged into trunk
Next Topic: Testing of migrated and upgraded forum
Goto Forum:
  


Current Time: Fri Nov 01 00:54:09 CET 2024

Total time taken to generate the page: 0.03182 seconds