Continue vs. discrete functions

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Raymond Chui

Continue vs. discrete functions

Post by Raymond Chui » Tue Jun 04, 2002 2:04 pm

Currently if I have two point x1,y1 and x2,y2 plot on XYChart. I will
auto get a solid line draw between two points. That looks like the
continuous function. Is there an option I can set ture/false to turn
on/off that solid line make it just plot the points, looks like discrete
function or discontinue XY plot?

David Gilbert

Re: Continue vs. discrete functions

Post by David Gilbert » Tue Jun 04, 2002 3:15 pm

This is controlled by the renderer object in the XYPlot. You can either use the createScatterPlot(...) method in the ChartFactory class, or change the renderer for an existing chart as follows:

XYPlot plot = myChart.getXYPlot();
XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, new StandardXYToolTipGenerator());
plot.setXYItemRenderer(renderer);

Regards,

DG.

josh

Re: Continue vs. discrete functions

Post by josh » Mon Jun 17, 2002 8:34 pm

in method drawItem of class StandardXYItemRenderer do this to make it discrete:

// get the previous data point...
//Number x0 = data.getXValue(series, item-1);
//Number y0 = data.getYValue(series, item-1);
Number x0=x1; //added this
Number y0=new Double(verticalAxis.getMinimumAxisValue()); //added this

Locked