Skip to content

Commit

Permalink
Remove Z axis by default from ChartImpl. Make FigureWiidgetTranslator…
Browse files Browse the repository at this point in the history
… assertions runtime errors. (#4510)
  • Loading branch information
devinrsmith authored Sep 18, 2023
1 parent 7b8bc7d commit 978e62c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Plot/src/main/java/io/deephaven/plot/ChartImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class ChartImpl implements Chart, PlotExceptionCause {
private final BaseFigureImpl figure;
@SuppressWarnings("unchecked")
private final List<AxisImpl>[] axis =
new List[] {new ArrayList<Axis>(), new ArrayList<Axis>(), new ArrayList<Axis>()};
new List[] {new ArrayList<Axis>(), new ArrayList<Axis>()};
private final List<AxesImpl> axes = new ArrayList<>();
private ChartType chartType;
private Font titleFont;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package io.deephaven.figure;

import io.deephaven.api.Selectable;
import io.deephaven.base.verify.Assert;
import io.deephaven.engine.table.PartitionedTable;
import io.deephaven.engine.table.Table;
import io.deephaven.gui.shape.JShapes;
Expand Down Expand Up @@ -170,7 +171,7 @@ private static <T> void assignOptionalField(T value, Consumer<T> setter, Runnabl
}

private FigureDescriptor.ChartDescriptor translate(ChartImpl chart) {
assert chart.dimension() == 2 : "Only dim=2 supported";
Assert.eq(chart.dimension(), "chart.dimensions()", 2);
FigureDescriptor.ChartDescriptor.Builder clientChart = FigureDescriptor.ChartDescriptor.newBuilder();

boolean swappedPositions = chart.getPlotOrientation() != ChartImpl.PlotOrientation.VERTICAL;
Expand All @@ -188,7 +189,7 @@ private FigureDescriptor.ChartDescriptor translate(ChartImpl chart) {
if ((i == 0 && !swappedPositions) || (i == 1 && swappedPositions)) {
type = AxisDescriptor.AxisType.X;
} else {
assert i == 0 || i == 1;
Assert.eqTrue(i == 0 || i == 1, "i == 0 || i == 1");
type = AxisDescriptor.AxisType.Y;
}
List<AxisImpl> currentPositionAxes = chart.getAxis()[i];
Expand Down Expand Up @@ -264,11 +265,11 @@ private FigureDescriptor.ChartDescriptor translate(ChartImpl chart) {
final AxisDescriptor catAxis;
final AxisDescriptor numAxis;
if (xAxis.getFormatType() == AxisDescriptor.AxisFormatType.CATEGORY) {
assert yAxis.getFormatType() == AxisDescriptor.AxisFormatType.NUMBER;
Assert.eq(yAxis.getFormatType(), "yAxis.getFormatType()", AxisDescriptor.AxisFormatType.NUMBER);
catAxis = xAxis;
numAxis = yAxis;
} else if (yAxis.getFormatType() == AxisDescriptor.AxisFormatType.CATEGORY) {
assert xAxis.getFormatType() == AxisDescriptor.AxisFormatType.NUMBER;
Assert.eq(xAxis.getFormatType(), "xAxis.getFormatType()", AxisDescriptor.AxisFormatType.NUMBER);
catAxis = yAxis;
numAxis = xAxis;
} else {
Expand Down

0 comments on commit 978e62c

Please sign in to comment.