jfreechart control OHLC time series range for dynamic display

110 views Asked by At

Using:

  • java 17
  • JavaFX 17
  • JFreeCharts 1.5.3
  • JFreeCharts FX 2.0.1

I would like to feed dynamic data to an OHLC plot with OHLCSeries I used the MaxItemCount but this is only good if all your time series has same dimensions

I need to show some trading signals that is not the same size as the OHLC series so the max item count will not work

Is there a way to show the latest 3 days (or the last 100 Hours) on a mixed series chart?

Using OHLCSeriesCollection for mixing OHLC and indicators (moving average) on the same chart. i.e. they don't happen on all the candle signals.

What if I need to add another TImeSeries (with a line&shape renderer) on the same chart but this one will have fewer items?

Can I use the Axis to control the items displayed by time?

    DateAxis dateAxis = new DateAxis("Time");

    CombinedDomainXYPlot mainPlot = new CombinedDomainXYPlot(dateAxis);

and adding data

    OHLCSeriesCollection candlestickDataset = new OHLCSeriesCollection();
    candlestickDataset.addSeries(new OHLCSeries());

    TimeSeriesCollection timeSeriesCollection = new TimeSeriesCollection();
    timeSeriesCollection.addSeries(new TImeSereis);

I noticed in old versions there was an option to add the TimeUint in the Series constructor. What is the alternative now?

ComparableObjectSeries doesnt have MaxItemAge?

EDIT:

Problem:

  • I have data with different occurrences over time
  • Data is TimeSeries & OHLCseries mix on the same chart (different renderers)
  • Data is dynamic and I would like to display only the last X points in time (3 days for example) i.e. aged are removed
0

There are 0 answers