Resize Vertical Tick Label Height (XYStepChart)

It’s not clear how you are formatting the dates now, but setDateFormatOverride in DateAxis allows you to specify a suitable SimpleDateFormat. If not already available, you should be able to override getShortMonths() in DateFormatSymbols for the Roman numerals. Addendum: For correct localization, it may be easier to do something like this: DateAxis axis = (DateAxis) … Read more

Jfree chart Find Subplot

You can get a List of subplots using getSubplots(). To learn which subplot was clicked, examine the ChartMouseEvent that was sent from the ChartPanel, as suggested here. Addendum: Here’s a simple implementation of ChartMouseListener that will show each ChartEntity as it is clicked. ChartPanel panel = … panel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent e) … Read more

scatter plot in jfreechart from database

This complete example creates a suitable database table in memory, queries it into a JDBCXYDataset and displays the dataset in a scatter plot. Note how the first column becomes the domain, while successive columns become individual series. import java.awt.EventQueue; import java.sql.Connection; import java.sql.Date; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; import java.util.Calendar; import java.util.Random; … Read more

JFreeChart create tooltip in ChartPanel

Most ChartFactory methods include a boolean tooltips parameter. Just look in the source for your factory of choice to see how to instantiate a default tooltip generator suitable for the designated renderer. You shouldn’t need to handle the events yourself. Addendum: As you are using createXYLineChart, an instance of StandardXYToolTipGenerator is supplied by default. The … Read more

Create jfreechart-1.5.3 JAR from source code

As illustrated here, you can clone the repository, check out the branch with the desired tag and use maven to build the release JARs. See also Migration from JFreeChart 1.0.x $ git clone https://github.com/jfree/jfreechart.git jfreechart $ pushd jfreechart $ git fetch –tags $ git tag –list … v1.5.3 $ git checkout v1.5.3 Note: switching to … Read more

Read data from CSV file into ArrayList and display in XY Chart

Several problems are evident: You never add anything to lines; at a minimum, you’ll need something like this: lines.add(line); Instead of ChartFactory.createXYLineChart(), consider creating a time series: ChartFactory.createTimeSeriesChart(…) The XYDataset returned by createDataset() should be a TimeSeriesCollection to which you add a TimeSeries. In createDataset(), iterate though lines, parse the data fields, and add the … Read more

tech