Reputation: 11
How to create TimeSeriesChart with constant distance for domain Axis (X values), just like LineChart but with DateAxis?
Normal TimeSeriesChart looks like this:
But I need something like:
with Date Axis on the bottom
Chart data are changing very frequently, and when I'm using simple LineChart domain axis is unreadable...
I've created some class extending XYSeries which sets next values to X and I've changed number formatter to render specific date, but this solution is just bad workaround
Upvotes: 1
Views: 121
Reputation: 205785
If you have significant gaps in the domain, you could try a CombinedRangeXYPlot
with a subplot for each contiguous time interval.
Addendum: Also, consider either or both of these settings for pan & zoom, illustrated here.
plot.setDomainPannable(true);
chartPanel.setMouseWheelEnabled(true);
Upvotes: 1
Reputation: 5923
Rather than extending XYSeries
try setting XYSeries#setMaximumItemCount(int)
to the maximum number of items that you want to show in you chart this will stop the chart becoming unreadable.
In your second screen it looks like you are using a constant x interval, if you time are constant you will get a chart like this, if not use an integer axis otherwise you will get irregular steps.
Upvotes: 1