javajfreechartjfreereport

Increase the length of line in legend in jfreechart


I am rendering a line chart using JFreechart. I need help to modify legend which is being rendered by the JFree. I need to increase the length of line in legend area. Below image shows the current output.

enter image description here

Below images shows what I want to achieve

enter image description here

Thanks


Solution

  • It can be done by using the code below:

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setLegendLine(new Line2D.Double(-20.0D, 0.0D, 20.0D, 0.0D));