code: private static OHLCDataset createOHLCDataset(TimeSeries series) {
          final int nbTicks = series.getTickCount();
          
          Date[] dates = new Date[nbTicks];
          double[] opens = new double[nbTicks];
          double[] highs = new double[nbTicks];
          double[] lows = new double[nbTicks];
          double[] closes = new double[nbTicks];
          double[] volumes = new double[nbTicks];
          
          for (int i = 0; i < nbTicks; i++) {
              Tick tick = series.getTick(i);
              dates[i] = new Date(tick.getEndTime().toEpochSecond() * 1000);
              opens[i] = tick.getOpenPrice().toDouble();
              highs[i] = tick.getMaxPrice().toDouble();
              lows[i] = tick.getMinPrice().toDouble();
              closes[i] = tick.getClosePrice().toDouble();
              volumes[i] = tick.getVolume().toDouble();
          }
          
          OHLCDataset dataset = new DefaultHighLowDataset("btc", dates, highs, lows, opens, closes, volumes);
          
          return dataset;
      }
docs: Builds a JFreeChart OHLC dataset from a ta4j time series.
  @param series a time series
  @return an Open-High-Low-Close dataset