Search code examples
javajfreechart

How to pass JSON input to JFreeChart


I am trying to figure out a way to produce test execution charts from cucumber produced JSON.

I looked into JFreeChart and would like to know if there a way to use JSON as input for JFreeChart or other java library.


Solution

  • JFreeChart won't read your JSON format data out-of-the-box, so you'll need to write your own code to process the JSON file/string and populate a dataset accordingly. I did something like this recently for Orson Charts, and used json-simple to do the JSON parsing. Of course, the code I wrote parses only a very specific set of JSON formats. I don't know the details of the "cucumber produced json" that you need to process, but hopefully the json-simple project can help you to get it done.