jfree / jfreechart

A 2D chart library for Java applications (JavaFX, Swing or server-side).
http://www.jfree.org/jfreechart/
GNU Lesser General Public License v2.1
1.22k stars 475 forks source link

XYSplineRenderer Horizantal Orientation Problem #357

Open salih-ozdemir opened 1 year ago

salih-ozdemir commented 1 year ago

On horizontal orientation, Firstly There is no problem with XYLineAndShapeRenderer, but XYSplineRenderer not draw graph. actually there is a drawing there but graph line meaninglessly hidden. when start graph only one part of line, but second process hidding line.

XYSplineRenderer has no problem on Vertical orientation. The problem start with horizontal orientation.

trashgod commented 1 year ago

It's not clear where your code is going awry, but two approaches are examined here: one illustrates using the existing renderer; the other illustrates a custom renderer.

salih-ozdemir commented 1 year ago

there is your good answer here. if change some line as

`public DynamicTimeSeriesChart(final String title) { dataset = new DynamicTimeSeriesCollection(1, 1000, new Second()); dataset.setTimeBase(new Second(0, 0, 0, 23, 1, 2014)); dataset.addSeries(new float[1], 0, title); chart = ChartFactory.createTimeSeriesChart( title, "Time", title, dataset, true, true, false); final XYPlot plot = chart.getXYPlot();

    //XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    XYSplineRenderer renderer = new XYSplineRenderer(15);
    plot.setRenderer(renderer);
    plot.setOrientation(PlotOrientation.HORIZONTAL);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setFixedAutoRange(10000);
    axis.setDateFormatOverride(new SimpleDateFormat("ss.SS"));
    final ChartPanel chartPanel = new ChartPanel(chart);
    add(chartPanel);
}`

not show line of graph. also shown vertex point. XYLineAndShapeRenderer working but XYSplineRenderer some bugs. this error repeated other render like XYBezierRenderer .

trashgod commented 1 year ago

I had no trouble with horizontal orientation in this example that uses XYLineAndShapeRenderer.

With XYSplineRenderer, which uses natural cubic splines, I see problems if the data are duplicated vertically, as happens with this example in the horizontal orientation. If I understand correctly, this is a limitation of splines.