Skip to content

Instantly share code, notes, and snippets.

@edpichler
Created January 28, 2014 23:11
Show Gist options
  • Save edpichler/8678605 to your computer and use it in GitHub Desktop.
Save edpichler/8678605 to your computer and use it in GitHub Desktop.
Changing the line size of a JFreeChart chart
private JFreeChart createChart(XYDataset dataset, ICarteira car) {
// create the chart...
final JFreeChart chart = ChartFactory.createTimeSeriesChart(
car.getNome(), // title
"Tempo", // x axis label
"Valor", // y axis label
dataset, // data
true, // include legend
true, // tooltips
true // urls
);
XYPlot plot = chart.getXYPlot();
// here we change the line size
int seriesCount = plot.getSeriesCount();
for (int i = 0; i < seriesCount; i++) {
plot.getRenderer().setSeriesStroke(i, new BasicStroke(2));
}
// line size changed
return chart;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment