I have added Candlestick chart to the latest version. I have also changed some of the API methods to make it easier to create your own charts when it is not available in the platform. (However, the better way is to do a pull request and contribute your code back to the add-on so that others will be benefitted from it).
In the latest version, it is easy to create a Candlestick chart if it were not available in the add-on.
```
private static class CandlestickChart extends XYChart {
private final AbstractDataProvider<?> xData;
private final CandlestickData data;
public CandlestickChart(AbstractDataProvider<?> xData, CandlestickData yData) {
super(ChartType.Line, xData, yData); // Declaring it as a normal line chart
this.xData = xData;
this.data = yData;
}
@Override
protected String typeValue() {
return "candlestick"; // It should be drawn as a candlestick chart, not as a line chart
}
@Override
protected AbstractDataProvider<?> dataToEmbed() {
return data; // This data should be embedded as the candlestick data
}
@Override
public void validate() throws ChartException {
super.validate();
Axis axis = getCoordinateSystem().getAxis(0); // X-axis
if(axis.getDataType() != DataType.CATEGORY) { // The x-axis should be a category axis
throw new ChartException("X-axis must be a category axis");
}
axis.setData(xData); // Set this as the data for the x-axis
}
}
public record Candlestick(Number opening, Number closing, Number low, Number high) {
@Override
public String toString() {
return "[" + opening + "," + closing + "," + low + "," + high + "]
";
}
}
public static class CandlestickData extends AbstractData<Candlestick> {
public CandlestickData(Candlestick... data) {
super(Candlestick.class, data);
}
}
```