Hi
I am trying to set the series/legend manually. I am using JdbcXYDataset which extracts from a database and plots the timeseries graph. But it also takes the name of the y-axis column in the database and plots it as the legend I don't want this how can I change this to my own legend name.
This is my code so far
// Create the chart
JFreeChart chart = ChartFactory.createTimeSeriesChart("Fire Alarm Report", "Time", "Temperature", dataset, true);
XYPlot plot = chart.getXYPlot();
VerticalNumberAxis axis = (VerticalNumberAxis)plot.getRangeAxis();
axis.setAutoRange(false);
axis.setMinimumAxisValue(0.0);
axis.setMaximumAxisValue(100.0);
HorizontalDateAxis axis = (HorizontalDateAxis)plot.getDomainAxis();
axis.setVerticalTickLabels(true);
chart.setLegend(null);
Kind Regards
A>M
Legend
Re: Legend
I'm not very familiar with the JDBC dataset classes, but it looks like the getSeriesName(int) method returns the column name (and it is the series name that end up in the legend). You could subclass the JdbcXYDataset class and override the getSeriesName(int) method to return anything you want...
Regards,
DG.
Regards,
DG.