is it possible to connect one point to all others around in JFreeChart
here how it should looks
You'll need a custom renderer. This minimal example overrides the XYLineAndShapeRenderer method drawPrimaryLine()
. It draws the lines relative to the item having anchor
as its series index. You'll need to recapitulate the existing implementation, replacing the lines shown below.
Addendum: The example simply passes anchor
as a constructor parameter, but you can extend XYDataset
to include a unique value for each series.
MyRenderer r = new MyRenderer(8);
XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), r);
JFreeChart chart = new JFreeChart(plot);
…
private static class MyRenderer extends XYLineAndShapeRenderer {
private final int anchor;
public MyRenderer(int acnchor) {
this.anchor = acnchor;
}
@Override
protected void drawPrimaryLine(XYItemRendererState state, Graphics2D g2,
XYPlot plot, XYDataset dataset, int pass, int series, int item,
ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea) {
if (item == anchor) {
return;
}
…
double x0 = dataset.getXValue(series, anchor);
double y0 = dataset.getYValue(series, anchor);
…
}
}