XYLinePlot curve jumps horizontally

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
me.getName()
Posts: 3
Joined: Sun Jul 04, 2010 1:26 pm
antibot: No, of course not.

XYLinePlot curve jumps horizontally

Post by me.getName() » Wed Sep 01, 2010 9:42 pm

Hi,

I am using an XYPlot to visualize some measurement data. I am creating a dataset (see below) passing an double[][]-Array which contains the data in columns (i.e. column 1: current; column 2: voltage, etc.).

Code: Select all

    private XYDataset createDataset(int[] col,double[][] pData, int multiplier) {
            String setName = "set_"+String.valueOf(datasetNumber);
            XYSeries set = new XYSeries(setName);
            for (int i=0; i<pData.length-2; i++){
                set.add(pData[i][col[0]],pData[i][col[1]]*multiplier);
            }
        return new XYSeriesCollection(set);
    }
The relevant code to create the plot is shown below.

Code: Select all

    private JFreeChart createChart() {
        JFreeChart chart = ChartFactory.createXYLineChart(titleText,"Power [mW]","Current [mA]",null,PlotOrientation.HORIZONTAL, false, true, false);
        plot = (XYPlot) chart.getPlot();
        plot.setDataset(this.datasetNumber,createDataset(col,retrieveData(pFile),1000));
        plot.setRenderer(this.datasetNumber, new XYLineAndShapeRenderer(true, false));
        ...}

Now if the curves are smooth, everything is fine. But as soon as the curve starts jumping from value to value, the Plot appears to draw lines horizontally. Whereas MATLAB or Origin plot the curves proerly, XYLinePlot seems to have a problem with heavy jumps in the dataset. I hope the links with the pictures work.

JFreeChart: Image
Origin: Image
In case the images are not shown, here the direct links:
JFreeChart: http://picasaweb.google.de/lh/photo/9vz ... directlink
Origin: http://picasaweb.google.de/lh/photo/IrZ ... directlink



I don't see why this happens. Does anyone know a solution or see the error I've made?
Thanks in advance.

Ben

Locked