Skip to content

Commit

Permalink
Remove OHLC charttype, XY will be used instead. (#2988)
Browse files Browse the repository at this point in the history
Allows a chart to contain both XY/scatter and ohlc data, though twin()
must still be used to share axes.

Fixes #2094
  • Loading branch information
niloc132 authored Dec 1, 2022
1 parent 6f587a4 commit 3f7bd07
Show file tree
Hide file tree
Showing 6 changed files with 518 additions and 503 deletions.
8 changes: 7 additions & 1 deletion Plot/src/main/java/io/deephaven/plot/AxesImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private void configurePiePlot() {

private void configureOHLCPlot() {
this.setDimension(2);
chart.setChartType(ChartType.OHLC);
chart.setChartType(ChartType.XY);
xAxis().setType(AxisImpl.Type.NUMBER);
yAxis().setType(AxisImpl.Type.NUMBER);
initialize();
Expand Down Expand Up @@ -1393,6 +1393,7 @@ public OHLCDataSeriesArray ohlcPlot(final Comparable seriesName, final Indexable
final IndexableNumericData open, final IndexableNumericData high, final IndexableNumericData low,
final IndexableNumericData close) {
configureOHLCPlot();
plotStyle(PlotStyle.OHLC);
final OHLCDataSeriesArray ds =
new OHLCDataSeriesArray(this, dataSeries.nextId(), seriesName, time, open, high, low, close);

Expand All @@ -1405,6 +1406,7 @@ public OHLCDataSeriesArray ohlcPlot(final Comparable seriesName, final Indexable
public OHLCDataSeriesTableArray ohlcPlot(final Comparable seriesName, final Table t, final String time,
final String open, final String high, final String low, final String close) {
configureOHLCPlot();
plotStyle(PlotStyle.OHLC);
final TableHandle h = new TableHandle(t, time, open, high, low, close);

final OHLCDataSeriesTableArray ds = new OHLCDataSeriesTableArray(this, dataSeries.nextId(), seriesName, h,
Expand All @@ -1421,6 +1423,7 @@ public OHLCDataSeriesTableArray ohlcPlot(final Comparable seriesName, final Tabl
public OHLCDataSeriesArray ohlcPlot(final Comparable seriesName, final SelectableDataSet sds, final String time,
final String open, final String high, final String low, final String close) {
configureOHLCPlot();
plotStyle(PlotStyle.OHLC);
final SwappableTable t = sds.getSwappableTable(seriesName, chart, time, open, high, low, close);

final OHLCDataSeriesSwappableTableArray ds = new OHLCDataSeriesSwappableTableArray(this, dataSeries.nextId(),
Expand All @@ -1445,6 +1448,7 @@ public MultiOHLCSeries ohlcPlotBy(final Comparable seriesName, final Table t, fi
ArgumentValidations.assertNotNull(close, "closeCol", new PlotInfo(this, seriesName));
ArgumentValidations.assertNotNullAndNotEmpty(byColumns, "byColumns", new PlotInfo(this, seriesName));
configureOHLCPlot();
plotStyle(PlotStyle.OHLC);

final TableBackedPartitionedTableHandle h = new TableBackedPartitionedTableHandle(t,
Arrays.asList(time, open, high, low, close), byColumns, new PlotInfo(this, seriesName));
Expand Down Expand Up @@ -1480,6 +1484,8 @@ public MultiOHLCSeriesSwappable ohlcPlotBy(final Comparable seriesName, final Se

final SwappableTable t = sds.getSwappableTable(seriesName, chart, columns);
configureOHLCPlot();
plotStyle(PlotStyle.OHLC);

final MultiOHLCSeriesSwappable series = new MultiOHLCSeriesSwappable(this, dataSeries.nextId(), seriesName, t,
time, open, high, low, close, byColumns);

Expand Down
4 changes: 4 additions & 0 deletions Plot/src/main/java/io/deephaven/plot/ChartType.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ public enum ChartType {

/**
* Open-high-low-close chart.
* <p>
* </p>
* Deprecated, use XY instead.
*/
@Deprecated(since = "0.18", forRemoval = true)
OHLC,

/**
Expand Down
Loading

0 comments on commit 3f7bd07

Please sign in to comment.