JFreeChart BarChart -> NO gradient

The problem lies in the BarPainter you are using. The JFreeChart version 1.0.13 default is to use GradientBarPainter which adds a metallic-ish look to the bar. If you want the “old” look the solution is to use the StandardBarPainter. final CategoryPlot plot = chart.getCategoryPlot(); ((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter()); That should do it. Alternatively, if you want … Read more

Invalid or corrupt JAR File built by Maven shade plugin

On my end if I build your project using the pom.xml you’ve showed us, with apache-poi declared after jfreechart, then as you’ve mentioned I get a corrupt JAR. Swapping the order of these two dependencies indeed gives me a correct JAR. I’ve some previous experience with the maven-shade-plugin and when I used it I had … Read more

Using JFreeChart to display recent changes in a time series

The JFreeChart class DynamicTimeSeriesCollection is a good choice. Addendum: As noted by @Bahadır, the last point of the series was persistently zero. @Don helpfully suggests advancing the time and then appending the data. dataset.advanceTime(); dataset.appendData(newData); import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.Timer; … Read more

tech