From cfbbe749e6d0c2ad6c03e1198272af261c8ac7a9 Mon Sep 17 00:00:00 2001 From: Matthew Runyon Date: Wed, 31 Jan 2024 14:04:23 -0600 Subject: [PATCH] refactor: Remove JSAPI databar code (#1758) Removing databar specific JSAPI code since this API will be moved to dh.ui at some point --- .../src/IrisGridTableModelTemplate.ts | 56 ------------------- packages/jsapi-types/src/dh.types.ts | 15 ----- 2 files changed, 71 deletions(-) diff --git a/packages/iris-grid/src/IrisGridTableModelTemplate.ts b/packages/iris-grid/src/IrisGridTableModelTemplate.ts index 608149c19e..bf1abb23ee 100644 --- a/packages/iris-grid/src/IrisGridTableModelTemplate.ts +++ b/packages/iris-grid/src/IrisGridTableModelTemplate.ts @@ -3,7 +3,6 @@ import memoize from 'memoize-one'; import throttle from 'lodash.throttle'; import { - CellRenderType, EditOperation, GridRange, GridUtils, @@ -39,13 +38,6 @@ import { assertNotNull, } from '@deephaven/utils'; import { TableUtils, Formatter, FormatterUtils } from '@deephaven/jsapi-utils'; -import type { - AxisOption, - DataBarOptions, - DirectionOption, - Marker, - ValuePlacementOption, -} from 'packages/grid/src/DataBarGridModel'; import IrisGridModel, { DisplayColumn } from './IrisGridModel'; import AggregationOperation from './sidebar/aggregations/AggregationOperation'; import IrisGridUtils from './IrisGridUtils'; @@ -646,54 +638,6 @@ class IrisGridTableModelTemplate< return 'left'; } - dataBarOptionsForCell( - column: ModelIndex, - row: ModelIndex, - theme: IrisGridThemeType - ): DataBarOptions { - const format = this.formatForCell(column, row); - assertNotNull(format); - const { axis, direction, max, min, valuePlacement, value, marker } = - format.formatDataBar; - let { positiveColor, negativeColor, markerColor, opacity } = - format.formatDataBar; - - positiveColor = positiveColor ?? theme.positiveBarColor; - negativeColor = negativeColor ?? theme.negativeBarColor; - let databarColor: string | string[] = - format.color ?? (value >= 0 ? positiveColor : negativeColor); - if (databarColor.includes(',')) { - databarColor = databarColor.split(','); - } - markerColor = markerColor ?? theme.markerBarColor; - - opacity = valuePlacement.toLowerCase() === 'overlap' ? 0.5 : opacity; - - const databarOptions = { - axis: axis.toLowerCase() as AxisOption, - direction: direction.toUpperCase() as DirectionOption, - columnMax: max, - columnMin: min, - opacity, - color: databarColor, - valuePlacement: valuePlacement.toLowerCase() as ValuePlacementOption, - value, - markers: [ - { - value: marker, - color: markerColor, - }, - ] as Marker[], - }; - - return databarOptions; - } - - renderTypeForCell(column: ModelIndex, row: ModelIndex): CellRenderType { - const format = this.formatForCell(column, row); - return format?.formatDataBar != null ? 'dataBar' : 'text'; - } - textForColumnHeader(x: ModelIndex, depth = 0): string | undefined { const header = this.columnAtDepth(x, depth); if (isColumnHeaderGroup(header)) { diff --git a/packages/jsapi-types/src/dh.types.ts b/packages/jsapi-types/src/dh.types.ts index 40d0ff1c9a..1d37819643 100644 --- a/packages/jsapi-types/src/dh.types.ts +++ b/packages/jsapi-types/src/dh.types.ts @@ -887,21 +887,6 @@ export interface Format { readonly color: string; readonly backgroundColor: string; readonly formatString: string; - readonly formatDataBar: DatabarFormat; -} - -export interface DatabarFormat { - axis: string; - direction: string; - max: number; - min: number; - negativeColor: string | string[]; - opacity: number; - positiveColor: string | string[]; - valuePlacement: string; - value: number; - marker: number; - markerColor: string | string[]; } export interface ColumnStatistics {