From 978e62c7f2c776a86b9a4943a81a5019bcfd69be Mon Sep 17 00:00:00 2001 From: Devin Smith Date: Mon, 18 Sep 2023 16:52:24 -0700 Subject: [PATCH] Remove Z axis by default from ChartImpl. Make FigureWiidgetTranslator assertions runtime errors. (#4510) --- Plot/src/main/java/io/deephaven/plot/ChartImpl.java | 2 +- .../java/io/deephaven/figure/FigureWidgetTranslator.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Plot/src/main/java/io/deephaven/plot/ChartImpl.java b/Plot/src/main/java/io/deephaven/plot/ChartImpl.java index eb26eee2878..8ab66e9e2c2 100644 --- a/Plot/src/main/java/io/deephaven/plot/ChartImpl.java +++ b/Plot/src/main/java/io/deephaven/plot/ChartImpl.java @@ -33,7 +33,7 @@ public class ChartImpl implements Chart, PlotExceptionCause { private final BaseFigureImpl figure; @SuppressWarnings("unchecked") private final List[] axis = - new List[] {new ArrayList(), new ArrayList(), new ArrayList()}; + new List[] {new ArrayList(), new ArrayList()}; private final List axes = new ArrayList<>(); private ChartType chartType; private Font titleFont; diff --git a/plugin/figure/src/main/java/io/deephaven/figure/FigureWidgetTranslator.java b/plugin/figure/src/main/java/io/deephaven/figure/FigureWidgetTranslator.java index 63fc8cd57e2..09c2a92f874 100644 --- a/plugin/figure/src/main/java/io/deephaven/figure/FigureWidgetTranslator.java +++ b/plugin/figure/src/main/java/io/deephaven/figure/FigureWidgetTranslator.java @@ -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; @@ -170,7 +171,7 @@ private static void assignOptionalField(T value, Consumer 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; @@ -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 currentPositionAxes = chart.getAxis()[i]; @@ -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 {