I'm working on a chart with financial data, using a large dataset. When I generate the chart, the x-axis is generated for the full range of dates. This makes the chart unreadable, as there are too much ticks. For example, I have a dataset for a week, with data for every minute.
I would like to show the chart's x-axis initially with just a limited date range, for example just 2 hours. The chart should then be pannable so that the rest of the date range can also be viewed. In other words, I would like the chart to contain a maximum amount of ticks, so that they don't overlap etc.
I have searched for various parameters but haven't been able to implement this. Is this possible? If so, how?
Limit date range of XYPlot x-axis
Re: Limit date range of XYPlot x-axis
You want to use a TimeSeries chart. The ticks then are relative to your view. I had a chart that was having the same issues are yours as my dataset is massive for the project I was creating (hourly data intervals). Use the chartfactory of a timeseries and use a dataset of a TimeSeriesCollection (desended of an abstractXYDataset) and you will arrive at your solution. The x-axis will allow you to zoom into the time section you need and not have so many ticks: http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=119704
Re: Limit date range of XYPlot x-axis
Thanks for your reply. I should have specified my question better though, as I need a Candlestick chart for this project. It is a TimeSeries but a ohlcDataset. So, is it possible to do this in such a chart? It would be ideal if the x-axis would be 'scrollable' to the left and right to move through the time series.
I already tried to work with a JScrollPane; while that did work in a way, it wasn't really a good solution as the axis labels and titles were scrolling outside the pane as well.
I already tried to work with a JScrollPane; while that did work in a way, it wasn't really a good solution as the axis labels and titles were scrolling outside the pane as well.
Re: Limit date range of XYPlot x-axis
I have managed to solve this problem by just disabling the zoom on the y-axis. This enables the user to zoom and pan on the x-axis as desired.