Why do renderers still use getXValue method??

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
havfrue
Posts: 29
Joined: Mon Nov 03, 2003 4:49 pm

Why do renderers still use getXValue method??

Post by havfrue » Mon Jun 07, 2004 12:52 pm

Why do renderers still use Number "getXValue(series, index) " and getYValue instead of "double getX(series, index)" and getY methods?

I guess rendering would be a lot faster if getX and getY had been used since they return double primitives.

(I render a large dataset using StandardXYItemRenderer in XYPlot).

E.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Jun 07, 2004 1:40 pm

You will see a transition over time where the renderers will be updated to use the (new) getX() and getY() methods (that return double primitives) (*). This will result in a performance gain where the underlying dataset stores the values as double primitives, but I don't think the gain will be that noticeable (data access time tends to be small relative to the data rendering time). That's my experience anyway - your mileage may vary.

The real motivation for the introduction of these new methods is to reduce the storage required for large datasets - there is some overhead with the use of Number objects that can be eliminated now (but note that the dataset classes shipping with JFreeChart at present still use Number objects in their implementation).

The support for Number objects in the XYDataset interface won't be removed, because it is useful in some applications for the dataset to be able to serve up Number objects that have been "pre-created". For example, any client application that displays a dataset in a JTable.

(*) Feel free to submit patches for specific renderers if you want to. I'll do the work eventually, but maybe not as fast as you'd like.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked