?control marker shape/color/size per-point (not per-series)

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
potential user @HP

?control marker shape/color/size per-point (not per-series)

Post by potential user @HP » Tue Feb 08, 2005 8:17 pm

Hello,

I need to create some XY scatterplots where each point has a different marker shape/color/size. :?: Can JFreeChart do it? The bubble chart demo comes closest, but it doesn't show whether the shape & size attributes can also be controlled on a per-point basis.

For example: http://www.tableausoftware.com/web/prod ... egies.html
http://www.spotfire.com/products/decisionsite.cfm
http://www.tableausoftware.com/web/prod ... ducts.html

If it can't yet, then I'd request this feature. Also, there might be text associated with each point. I understand you support per-point tooltips, so that's good.

George

Guest

example image

Post by Guest » Tue Feb 08, 2005 11:28 pm

Here's a couple example images of what could be done with this capability:

Image[/img]

Image

Guest

gnuplot 4.1 can now do it

Post by Guest » Wed Feb 09, 2005 5:47 pm

FYI, this capability has just been added in gnuplot v4.1:

splot 'earthquakes.csv' using 1:2:3:4 with points pt 5 pointsize var linetype palette
Image


And it can also plot text labels next to each marker, controlling the color of the text:
splot 'my.dat' using 1:2:(1):3:4 with labels notitle point pt 6 lw .1 left offset 1,0 font "Helvetica,7" tc pal
Image


Just posting, FYI. No competition intended. The world fully needs a Java library to do this stuff..

potential user @HP

how to go about it

Post by potential user @HP » Thu Feb 10, 2005 6:54 pm

May I conclude from the silence that JFreeChart doesn't currently support this?

So, how would one go about this? Create a new subclass of the XY dataset that has additional methods such as:
getMarkShape(int series, int index)
getMarkSize(int series, int index)
getMarkFillColor(int series, int index)
getMarkOutlineColor(int series, int index)
getMarkTooltip(int series, int index)
(or perhaps just a getMarker(int,int) or drawMarker(g2......))

and then perhaps JFreeChart could make use of this "tabular" dataset view for drawing the scatterplot.

What do you think?

Any way this could be factored better so it's easy for a user to tweak which attributes get used for color,shape,size,etc. One might like to use a different attribute for the size without having to go re-write the code. Also, the color chosen might be with respect to a pallete of colors that depends on the range of the attribute being plotted. Instead of the dataset returning the color orange, it should just return a number, which gets histogrammed by the JFreeChart infrastructure and converted into a nice color spectrum.

Any OO gurus out there who could suggest a design that would factor well?

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

Re: how to go about it

Post by david.gilbert » Thu Feb 10, 2005 9:03 pm

potential user @HP wrote:May I conclude from the silence that JFreeChart doesn't currently support this?
Silence from me usually means I'm too busy to respond to issues in the free support forum.
potential user @HP wrote:So, how would one go about this? Create a new subclass of the XY dataset that has additional methods such as:
getMarkShape(int series, int index)
getMarkSize(int series, int index)
getMarkFillColor(int series, int index)
getMarkOutlineColor(int series, int index)
getMarkTooltip(int series, int index)
(or perhaps just a getMarker(int,int) or drawMarker(g2......))

and then perhaps JFreeChart could make use of this "tabular" dataset view for drawing the scatterplot.

What do you think?

Any way this could be factored better so it's easy for a user to tweak which attributes get used for color,shape,size,etc. One might like to use a different attribute for the size without having to go re-write the code. Also, the color chosen might be with respect to a pallete of colors that depends on the range of the attribute being plotted. Instead of the dataset returning the color orange, it should just return a number, which gets histogrammed by the JFreeChart infrastructure and converted into a nice color spectrum.

Any OO gurus out there who could suggest a design that would factor well?
Extending the XYDataset interface is the way that this has been done for other "special" plot types (e.g. high-low charts). It doesn't seem that clean a solution to me, but I haven't really had time to explore other alternatives. One idea would be to write an XYOb jectDataset interface, that is like the XYZDataset interface but the 'Z' is an object - then have renderers cast that to whatever they are expecting.
David Gilbert
JFreeChart Project Leader

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

re-engage
Posts: 6
Joined: Fri Jan 09, 2015 12:44 pm
antibot: No, of course not.

Re: ?control marker shape/color/size per-point (not per-seri

Post by re-engage » Fri Feb 06, 2015 10:34 am

i have now your same problem with a bubble chart..... do you have found a solution ?

Locked