This blog has moved!

You will be automatically redirected to the new address. If that does not occur, visit
http://blog.xeiam.com
and update your bookmarks.

Sunday, May 26, 2013

XChart 2.2.0 Released!

XChart, A Simple Charting Library for Java, licensed under the Apache 2.0 license, version 2.2.0 was released today! This release brings many exciting features most notably a MATLAB theme, CSV import/export, and high-resolution chart exporting. The newest features of the XChart library include:
  • Themes - XChart, GGPlot2, MATLAB
  • CSV import and export
  • High resolution chart export

For more features, see XChart 2.0.0 Released! and XChart's home page.

A Swing demo is also available for download along with the main xchart jar here. To run the demo from the command line type the following:
 cd /path/to/xchart-demo/jar/  
 java -cp xchart-demo-2.2.0.jar:xchart-2.2.0.jar com.xeiam.xchart.demo.XChartDemo  

The following three images show the three themes that are currently implemented - XChart, GGPlot2, and MATLAB.





Finally, here's how you can save a chart in high-resolution format specifying the DPI. This is useful when you want your charts to appear in printable material such as PDFs or books.

    BitmapEncoder.savePNG(chart, "./Sample_Chart.png");
    BitmapEncoder.savePNGWithDPI(chart, "./Sample_Chart_300_DPI.png", 300);

The difference is resolution is very clear in the following images.

1 comment:

  1. I just bumped MultiBit, which uses XChart, from v2.1.0 to v2.2.0. No problems. Recommended if you want to have graphs in your app but don't want to spend too much time fiddling around.

    ReplyDelete