1

I am currently making xy scatter plot, and i have code for setting the properties of my line graph.

private static void setLineProp(XYPlot plot, Color c) {
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    renderer.setSeriesShapesVisible(0, true);
    renderer.setBaseItemLabelsVisible(true);
    renderer.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition(
            ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER));

    renderer.setSeriesPaint(0, c);
    plotRev.setRenderer(0, renderer);
}

This will generate a label for every data point on top of the line graph, but some points are very close together and causes the labels to become jumbled and unreadable.

I was wondering if there is a way to alternate individual point label above and below the line graph or even alternate the label offset so that the text does not jumble up?

3
  • Would tooltips work?
    – trashgod
    Nov 1, 2014 at 3:41
  • i tried using tool tips, but I could not get it to show up for every point. I ended up tilting the labels 45 degrees so it doesn't overlap with other labels. Nov 5, 2014 at 20:57
  • I don't know a better alternative.
    – trashgod
    Nov 5, 2014 at 21:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.