
Curved Line Charts
Curved Line Charts
Is it possible to use curved lines in a line chart instead of jaggedness like so:


-
- Posts: 844
- Joined: Fri Oct 13, 2006 9:29 pm
- Location: Sunnyvale, CA
Yes, use XYSplineRenderer.tox0tes wrote:Is it possible to use curved lines in a line chart instead of jaggedness
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
Hi
I instance an JFreeChart object
JFreeChart chart = ChartFactory.createLineChar(..);
so
chart.getPlot(); returns a CategoryPlot
chart.getXYPlot(); crash with: java.lang.ClassCastException: org.jfree.chart.plot.CategoryPlot cannot be cast to org.jfree.chart.plot.XYPlot
CategoryPlot.setRenderer( new XYSplineRenderer() ); will not work, so how can I use Splinerenderer?
I use version 1.0.9.
Thanks in advance
I instance an JFreeChart object
JFreeChart chart = ChartFactory.createLineChar(..);
so
chart.getPlot(); returns a CategoryPlot
chart.getXYPlot(); crash with: java.lang.ClassCastException: org.jfree.chart.plot.CategoryPlot cannot be cast to org.jfree.chart.plot.XYPlot
CategoryPlot.setRenderer( new XYSplineRenderer() ); will not work, so how can I use Splinerenderer?
I use version 1.0.9.
Thanks in advance
-
- Posts: 844
- Joined: Fri Oct 13, 2006 9:29 pm
- Location: Sunnyvale, CA
Code: Select all
import org.jfree.chart.renderer.xy.XYSplineRenderer;
cannot find symbol
symbol : class XYSplineRenderer
location: package org.jfree.chart.renderer.xy
-
- Posts: 844
- Joined: Fri Oct 13, 2006 9:29 pm
- Location: Sunnyvale, CA
XYSplineRenderer has been available since v1.0.7 as stated in the JavaDoc, so you must be using v1.0.7 or later.tox0tes wrote:I am gettingCode: Select all
import org.jfree.chart.renderer.xy.XYSplineRenderer;
cannot find symbol
symbol : class XYSplineRenderer
location: package org.jfree.chart.renderer.xy
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
-
- Posts: 844
- Joined: Fri Oct 13, 2006 9:29 pm
- Location: Sunnyvale, CA
-
- Posts: 844
- Joined: Fri Oct 13, 2006 9:29 pm
- Location: Sunnyvale, CA
The auto-range is best on the minimum and maximum values in the dataset plus some margin. The spline is not considered. The easiest solution would be to increase the lower margin, but feel free to contribute a patch if you figure out a more robust solution.tox0tes wrote:almost.... there is a problem where the curve extends beyond the auto-range:
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA