Missing reset() method for RendererState?

A free public discussion forum for the JFreeChart class library.

Missing reset() method for RendererState?

Postby uvoigt » Fri Sep 28, 2007 12:51 pm

Hi!

I have implemented some special renderer implementations and today I noticed that the renderer internal RendererState object is not initialized separately for each dataset. This is quite painful because I save some informations in this object which is only valid for one dataset. With the current implementation I cannot detect inside Renderer.drawItem(..) if I still render the same dataset like before or if this is the first call with a new dataset. item==0 does not work anymore because the current XYPlot implementation sometime does not start rendering at item 0 for performance reasons :D

Let me give an example what I want to do with the RenderState:
Supposed I have a dataset with lots of xy values. Now it is possible that the dataset contains 10 different y values that are rendered a the same x pixel coordinate (not value - I really mean pixel). This causes the renderer to draw a long vertical line from the lowest to highest y value at the same x pixel. My specialized renderer now should draw not each y value separately but a mean value of them. So I only have in maximum one render point at one x pixel coordinate. If I zoom in then I will get all y values in more detail.

Puuuuh, Saving of the values at the same x coordinate now must be done in the RenderState object. And data values of two different datasets should not be mixed. Therefore I need something like a reset() or triggerNewDataset() method for the RenderState object.

Please ask if you don't completely understand what I want. It's really complex and it dives very deep into the internals of freechart.

Ulrich
uvoigt
 
Posts: 165
Joined: Mon Aug 23, 2004 10:50 am
Location: Germany

Postby uvoigt » Wed May 28, 2008 11:29 am

The described problem still exist. What are your opinions about that?
uvoigt
 
Posts: 165
Joined: Mon Aug 23, 2004 10:50 am
Location: Germany

Postby david.gilbert » Wed May 28, 2008 9:04 pm

Hi,

It sounds like a reasonable thing to add. I don't have time to look closely at it this week - I'll try to look at it on Monday or Tuesday. Can you remind me about it if I don't remember?
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11336
Joined: Fri Mar 14, 2003 10:29 am

Postby uvoigt » Thu Jun 12, 2008 10:28 am

Hi David,
did you already have a look on it?

Ulrich
uvoigt
 
Posts: 165
Joined: Mon Aug 23, 2004 10:50 am
Location: Germany

Postby david.gilbert » Mon Jun 16, 2008 8:42 am

Aargh, I forgot it. I'll look at it today.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11336
Joined: Fri Mar 14, 2003 10:29 am

Postby david.gilbert » Wed Jun 18, 2008 2:52 pm

Or maybe today!
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11336
Joined: Fri Mar 14, 2003 10:29 am

Re: Missing reset() method for RendererState?

Postby david.gilbert » Wed Jun 18, 2008 3:50 pm

uvoigt wrote:And data values of two different datasets should not be mixed. Therefore I need something like a reset() or triggerNewDataset() method for the RenderState object.


Each dataset has its own renderer, and a new RendererState object is created when the renderer is asked to draw a dataset...so there is no risk of data values from two different datasets being mixed. But I'm wondering if you really meant that you don't want to mix data values from two series WITHIN a dataset...in which case a resetSeriesState() method would be a useful addition. The default implementation could be an empty method that is called at the right points by the renderer, and you could override it to clear any data that you want to discard at the end of each series that is processed.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11336
Joined: Fri Mar 14, 2003 10:29 am

Postby uvoigt » Thu Jun 19, 2008 8:52 am

Hi David,

I think you have understood me right. But I think the method could not be called by the renderer but by the plot. I am not sure...

To get a better basis for the discussion I have commited a patch (https://sourceforge.net/tracker/index.php?func=detail&aid=1997549&group_id=15494&atid=315494). It gives a first try to implement this feature. I have created two methods startPlotPass and finishPlotPass and gave them some parameters which might be useful.

Feel free to modify this in any direction. The patch is a very quick try :wink:

Ulrich
uvoigt
 
Posts: 165
Joined: Mon Aug 23, 2004 10:50 am
Location: Germany

Postby david.gilbert » Wed Jul 09, 2008 4:38 pm

Thanks for your patience...I'm looking at this now.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11336
Joined: Fri Mar 14, 2003 10:29 am

Postby uvoigt » Thu Sep 25, 2008 8:21 am

Hi David,
thanks for integrating my proposal to JFreeChart. I have updated my renderers to 1.0.11 and they are running quite well now! Your committed solution seems to meet all needs.

Thanks!
Ulrich
uvoigt
 
Posts: 165
Joined: Mon Aug 23, 2004 10:50 am
Location: Germany


Return to JFreeChart - General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests