I'm in the planning process for a java based application that is used for live streaming/trading of stock/forex etc. charts. However I am not sure which charting library is the right one for the job.
Basically the charting functionality should be the same as in any trading software, such as:
- Candlestick and/or OHLC bar charts, line charts
- Overlaying those with other charts (Aka plotting an Moving average or similar over the candlestick chart)
- User should be able to add lines or other objects to the chart
- Displaying 2 charts, for example to show volume below the main chart
- Zoom into the chart**
- Horizontal scrolling/panning**
- Auto-adjusting of Y axis while scrolling/panning
- Updating of the chart when new data arrives (happens in random ms intervals), which does not only include a new OHLC data point to be added, but also to update the last OHLC data point if new data arrives before the timeframe indicates a new data point**
- interaction with the chart such as highlighting an object the mouse points to***
- giving back coordinates, that can be used to get the data points information, or directly get its information (OHLC data, timestamp)
** could also be done by creating a new chart each time a user action is done instead of letting the chart library do the work - however only viable if it is fast, see performance requirements.
*** Nice but not mandatory.
To make it clear - I am not searching for some magic library that does it all for me. I have no problem with writing code to get my full feature set. But some features can only reliably be implemented by the library itself (such as transforming chart coordinates from a mouse click to the right data points, because those coordinates are dependent on the size of the x and y labels, meaning guesstimating would be a bad approach), other features, when added, must still be fast enough. Depending on the library, this may not be possible.
Performance is a key factor. I have done most of this coding in python already, using matplotlib. However the more candles on the chart, the slower it gets, to a point where using multiple charts with enough data on each chart makes updates in millisecond intervals impossible in real time, despite long efforts to optimize the code. In addition, that code is restricted to one core(thanks to python GIL), no matter how many charts. So its understandable that I am desperately looking for a speedy solution and switched to java. So lets say having open 10 charts at the same time, with a few hundred OHLC data points, all updating at once should not cause a major impact in performance, barely noticeable to the human eye. This is something that can be done using java, as various commercial projects show (Oanda and Dukascopy java clients for example).
The question is, which library is up for the task? jFreeChart? JavaFX charting directly? Other options?
Does anyone know what libraries commercial projects use?