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
Re: New graph packages [message #35610 is a reply to message #35604] Mon, 05 March 2012 22:33 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hi Koldo,

As a matter fact it is exactly what I am doing.

I tried to modify ScatterCtrl but understanding everything took me to much time since there aren't any comments.

So I decided to create a new Graph package that uses the maximum of what you did (DataSource class fo example) but fills the areas which I feel need to be gapped.

Things are taking form so I'll publish wehn finished (quickly I hope ).

Re: New graph packages [message #35615 is a reply to message #35610] Tue, 06 March 2012 20:37 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Hello Didier

Quote:

I tried to modify ScatterCtrl but understanding everything took me to much time since there aren't any comments.

I understand you. If you have followed my posts about Scatter you will see that I have tried to avoid modifying original code and style as much as possible. However if you see my previous post, you will see this first point:
Quote:

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++

So if main ScatterCtrl/ScatterDraw users agree with interface, I would ask you to wait until I can review the code to do it more legible. Could you wait a little bit? Smile.

Please do not do a new graph package. First was Andrei-Catalin, then I added new things, after that dolk.rce did a new package... many efforts for only one package, and there are many new packages to do... Smile



Best regards
Iñaki
Re: New graph packages [message #35616 is a reply to message #35615] Tue, 06 March 2012 21:17 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hi Koldo,

Quote:

First was Andrei-Catalin, then I added new things, after that dolk.rce did a new package... many efforts for only one package, and there are many new packages to do...


I really need a good Graph ctrl and neither PlotCtrl nor ScatterCtrl fit my needs (which are quite simple) Crying or Very Sad .

My goal is not to make yet another Graph Ctrl but to use the maximum of what you created and only rebuilding what needs to.

In fact all the formulas are very complicated (to much) and it's very difficult and tricky to enhance it.

I am focusing on the following points:

  • Axis management : drawing/steps management/min-max mondification
  • Calculation simplification
  • Axis/title/legend position : make all these items modifiable


I dont need to rebuild data painting, the one you build is fine and configurable Smile

So I hope I can comme up with something that can easily be merged with ScatterCtrl

Anyway, even if it finally goes to trash, it's the first time I try to build a Ctrl from scratch, so I will learn many things Wink

[Updated on: Tue, 06 March 2012 22:06]

Report message to a moderator

Re: New graph packages [message #35617 is a reply to message #35616] Tue, 06 March 2012 23:40 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Hello Didier

Quote:

.. and neither PlotCtrl nor ScatterCtrl fit my needs (which are quite simple).

We would be glad to implement what you need. Just describe it or put some samples or screenshots about it.

Quote:

So I hope I can come up with something that can easily be merged with ScatterCtrl.

Of course any additions and proposals are very Smile acknowledged. Meanwhile from your point of view could we follow with the proposals as I included them in previous post?:
Quote:

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


There are some new things I would like add to these packages. However I would like to know before if you want anything to change, mainly in the public methods. This way the classes could be used immediatelly.


Best regards
Iñaki
Re: New graph packages [message #35619 is a reply to message #35616] Wed, 07 March 2012 08:02 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Didier wrote on Tue, 06 March 2012 15:17


So I hope I can comme up with something that can easily be merged with ScatterCtrl

Anyway, even if it finally goes to trash, it's the first time I try to build a Ctrl from scratch, so I will learn many things Wink


Well, creating Ctrl from scratch certainly has its educational value.

Long term, I wish there was only one graphing package, which should evolve from current ScatterCtrl. So let us hope your code will be easy to merge Smile

Meanwhile, if you want your code public, please commit it to sandbox (not bazaar).

Mirek
Re: New graph packages [message #35622 is a reply to message #35619] Wed, 07 March 2012 09:18 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Hello Mirek

Quote:

...which should evolve from current ScatterCtrl

Where should evolve ScatterCtrl?. Now it is in a "limbo"...


Best regards
Iñaki

[Updated on: Wed, 07 March 2012 09:20]

Report message to a moderator

Re: New graph packages [message #35623 is a reply to message #35622] Wed, 07 March 2012 09:31 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
koldo wrote on Wed, 07 March 2012 03:18

Hello Mirek

Quote:

...which should evolve from current ScatterCtrl

Where should evolve ScatterCtrl?. Now it is in a "limbo"...


Sense we are adopting it soon to upp.src... I wanted to make one more pass through it before that, but maybe even that is not necessarry. That said, I might need it in my production code, so perhaps will happen anyway. And after that, I it is not dead code, so it will evolve more Smile
Re: New graph packages [message #35628 is a reply to message #35623] Wed, 07 March 2012 22:24 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Quote:

Well, creating Ctrl from scratch certainly has its educational value.


Mainly for fun Razz

Quote:

Long term, I wish there was only one graphing package, which should evolve from current ScatterCtrl. So let us hope your code will be easy to merge Smile


Several parts of ScatterCtrl can be separated (which I did for needs):

  • SeriesPlot
  • MarkPlot
  • DrawingFunctions
  • DataSource

I will use them "as is" if possible
So if Koldo can do a clean Separation of these parts from the ScatterCtrl merge could be trivial

Currently I have introduced a GridAxisDraw class that draws the axis and also Grid. The main point is to make grid/axis look extendable and also make grid steps extendable (through class derivation). For ex: maybe I need the steps have certain periodicity or for log a different representation.
This class also contributes to the coordinate conversion ==> this way we could click on the axis, modify ranges/scale ==> and grid/points tied to this axis (and only these points get rescaled)
NB: the coordinate conversion is not owned by this class, another helper class is in charge of this.

Quote:


Meanwhile, if you want your code public, please commit it to sandbox (not bazaar).


When I have something that I find "publishable" I will do it.

[Updated on: Wed, 07 March 2012 22:26]

Report message to a moderator

Re: New graph packages [message #35632 is a reply to message #35628] Thu, 08 March 2012 12:57 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Hello Didier

I have begun clarifying (not simplifying) a little bit the mathematics and changing names of some confusing variables (like "l" and "h"). In addition now there will be different left/right and top/bottom margins.

As it is useful for you I will separate in different files, classes:
- SeriesPlot
- MarkPlot
- DrawingFunctions

And DataSource in a different package.

In addition I will try to separate in different classes:
- GridAxisDraw including grid texts
- LegendDraw for graph legends (following PlotCtrl suggestion)

This way Scatter classes will be even more flexible...


Best regards
Iñaki
icon14.gif  Re: New graph packages [message #35644 is a reply to message #35632] Fri, 09 March 2012 15:17 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hi Koldo,

Quote:

As it is useful for you I will separate in different files, classes:
- SeriesPlot
- MarkPlot
- DrawingFunctions
You're class separation fit perfectly with my code Smile

Except for one thing:
	static Color GetNewColor(int id);
	static String GetNewDash(int id);
	static MarkPlot *GetNewMarkPlot(int id);

These methods need to go public.


Looking closer at the SeriesPlot and MarkPlot classes, I think
it could be a good idea to add a
virtual void SetScale(int  scale) {}
method in SeriesPlot and MarkPlot classes.
This would enable children classes to have premultiplied values if needed.

This could be very useful to speed up the of drawing complex marks or line styles since 'SetScale()' would get called only once per drawn series (and not for each point drawn).

Re: New graph packages [message #35652 is a reply to message #35644] Fri, 09 March 2012 23:27 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Koldo,

I needed to separate another part to make it common: the one that manages the series list.

To do that, I used CRTP (Curiously Recurring Template Pattern) and added a SeriesGroupClass.

I extracted only the common parts, all specif methods like :
  • SetDataPrimaryY()
  • SetSequentialX()
  • ...
were left in ScatterDraw.

I modified ScatterCtrl svn:4671 (see attached file)
==> all works fine in ScatterCtrl_demo.

With this I have exactly the same interface for:
  • data managing
  • line style plot
  • mark style plot


NB: I also had to do some other minor changes:
Color GetNewColor(int id);
String GetNewDash(int id);
MarkPlot *GetNewMarkPlot(int id);
were moved to DrawingFuntions
and
Scatter::Refresh()
was made public

Do you agree to take these changes in account ? Rolling Eyes

I think all common parts ( at least in version 4671 ) are axtracted...



Re: New graph packages [message #35662 is a reply to message #35652] Sun, 11 March 2012 18:16 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Hello Didier

I have tried to understand your changes unsuccessfully. It is difficult for me to follow the changes in the files.

This functions:
Color GetNewColor(int id);
String GetNewDash(int id);
MarkPlot *GetNewMarkPlot(int id);

are already protected because they are only used in ScatterDraw classes and subclasses, so apparently they do not need to be out.

About SetScale(), AFAIK I see all drawing functions get scale only once per drawn series.

It is very interesting to have exactly the same interface for:
  • data managing
  • line style plot
  • mark style plot

Please include a proposal of the declarations of this functions.

Refresh() is now public.


Best regards
Iñaki
Re: New graph packages [message #35667 is a reply to message #35662] Sun, 11 March 2012 19:50 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hello Koldo,

Quote:

I have tried to understand your changes unsuccessfully. It is difficult for me to follow the changes in the files.

The changes I made are not functionnal modifications.
The idea is to move the common code from class A to a new template class: B.
The original class (A) then inherits from B: class a : public B {};
==> Class A therefore ahs the same methods as before, except for one (big) difference:
The return type of the methods : B::x() can only be of type B and not A Confused
Usually in Upp method calls are chained: we write : x0().x1().x2()

So if I do
class a : public B {};
==> the method chaining is then broken Crying or Very Sad

To prevent this, we can use CRTP in order to have correct return types
CRTP


Better than long text here is an example:
-------------------- Case 1 : the original code
class OriginalClass {
	public:
	OriginalClass() {}
	OriginalClass& fctA() { .....; return *this; }
	OriginalClass& fctD() { .....; return *this; }
};


we can write :
OriginalClass inst;
isnt.fctA().fctB();
but all is contained in 1 class Confused


-------------------- Case 2 : naive separation (does not work)
class BaseClass {
	public:
	BaseClass() {}
	BaseClass& fctA() { .....; return *this; }
};
class DerivedClass : public  BaseClass {
	public:
	DerivedClass() {}
	DerivedClass& fctD() { return *this; }
};

==> we ##CAN NOT## write :
DerivedClass inst;
isnt.fctA().fctB();    ==> compilation error
Crying or Very Sad

-------------------- Case 3 : separation using CRTP
template<class DERIVED>
class BaseClass {
	public:
	BaseClass() {}
	DERIVED& fctA() { return *static_cast<DERIVED*>(this); }
};
class DerivedClass : public  BaseClass<DerivedClass> {
	public:
	DerivedClass() {}
	DerivedClass& fctD() { return *this; }
};


==> We CAN write :
DerivedClass inst;
isnt.fctA().fctB();
==> ScatterCtrl still works
and separation has been made Cool Cool Cool ==> I can reuse it !!!

So please reconsider Uh Oh these changes since I only MOVED code and NOT CHANGED code.

[Updated on: Sun, 11 March 2012 19:55]

Report message to a moderator

Re: New graph packages [message #35670 is a reply to message #35667] Sun, 11 March 2012 21:17 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Hello Didier

Sorry, I thought CRTP was a kind of joke instead of a "curiously recurring template pattern" Smile.

A drawback of increasing the degree of class templating is that classes are getting more complex without adding functionality. I think we do not have to forget that.

I will try it again...


Best regards
Iñaki
Re: New graph packages [message #35671 is a reply to message #35670] Sun, 11 March 2012 22:22 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hello Koldo,

Quote:

A drawback of increasing the degree of class templating is that classes are getting more complex without adding functionality. I think we do not have to forget that.
Yes I know, but without this, I can't take advantage of you're code, and interface will probably diverge Crying or Very Sad Crying or Very Sad

But if it's really a problem I'll just copy it for now.

[Updated on: Sun, 11 March 2012 22:23]

Report message to a moderator

Re: New graph packages [message #35672 is a reply to message #35662] Sun, 11 March 2012 22:42 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Koldo
koldo wrote on Sun, 11 March 2012 18:16

This functions:
Color GetNewColor(int id);
String GetNewDash(int id);
MarkPlot *GetNewMarkPlot(int id);

are already protected because they are only used in ScatterDraw classes and subclasses, so apparently they do not need to be out.

Simple usecase where having these methods publicly available would be very helpful:

If there is multiple series, I would call GetNewColor(my_series_id) to assign color after each ordering change (where my_series_id is some unique identification of the series that doesn't depend on it's position in graph). The goal is to keep the colors the same even when some series are removed, added or sorted differently. It helps to keep the graphs easily "readable" Wink

The same holds for GetNewDash and for GetNew_MarkPlot... Please consider making them publicly available, all it will cost you is three declarations in header file Wink

Best regards,
Honza
Re: New graph packages [message #35675 is a reply to message #35671] Mon, 12 March 2012 09:10 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Hello Didier

Yes I know, but without this, I can't take advantage of you're code, and interface will probably diverge
It is difficult to optimize a class to match to something only you knows.

It would be better if you would make public your needs to see how to match code with them.


Best regards
Iñaki
Re: New graph packages [message #35676 is a reply to message #35672] Mon, 12 March 2012 09:12 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
dolik.rce wrote on Sun, 11 March 2012 22:42

Hi Koldo
koldo wrote on Sun, 11 March 2012 18:16

This functions:
Color GetNewColor(int id);
String GetNewDash(int id);
MarkPlot *GetNewMarkPlot(int id);

are already protected because they are only used in ScatterDraw classes and subclasses, so apparently they do not need to be out.

Simple usecase where having these methods publicly available would be very helpful:

If there is multiple series, I would call GetNewColor(my_series_id) to assign color after each ordering change (where my_series_id is some unique identification of the series that doesn't depend on it's position in graph). The goal is to keep the colors the same even when some series are removed, added or sorted differently. It helps to keep the graphs easily "readable" Wink

The same holds for GetNewDash and for GetNew_MarkPlot... Please consider making them publicly available, all it will cost you is three declarations in header file Wink

Best regards,
Honza


Hello Honza

Is perhaps the solution to add some kind of graph KEY or ID as in GridCtrl?


Best regards
Iñaki
Re: New graph packages [message #35678 is a reply to message #35676] Mon, 12 March 2012 10:45 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

koldo wrote on Mon, 12 March 2012 09:12

dolik.rce wrote on Sun, 11 March 2012 22:42

Hi Koldo
koldo wrote on Sun, 11 March 2012 18:16

This functions:
Color GetNewColor(int id);
String GetNewDash(int id);
MarkPlot *GetNewMarkPlot(int id);

are already protected because they are only used in ScatterDraw classes and subclasses, so apparently they do not need to be out.

Simple usecase where having these methods publicly available would be very helpful:

If there is multiple series, I would call GetNewColor(my_series_id) to assign color after each ordering change (where my_series_id is some unique identification of the series that doesn't depend on it's position in graph). The goal is to keep the colors the same even when some series are removed, added or sorted differently. It helps to keep the graphs easily "readable" Wink

The same holds for GetNewDash and for GetNew_MarkPlot... Please consider making them publicly available, all it will cost you is three declarations in header file Wink

Best regards,
Honza


Hello Honza

Is perhaps the solution to add some kind of graph KEY or ID as in GridCtrl?


Yes, that would solve the situation from the other side Smile It seems little bit more difficult to implement this way, but possibly more versatile.

Honza
Re: New graph packages [message #35680 is a reply to message #35678] Mon, 12 March 2012 12:16 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Quote:

Yes, that would solve the situation from the other side Smile It seems little bit more difficult to implement this way, but possibly more versatile.
Hello Honza

What interface do you propose?. I mean, how would you change AddSeries() functions and other?


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: Thu Apr 25 17:04:14 CEST 2024

Total time taken to generate the page: 0.03092 seconds