Skip to content

Commit

Permalink
refactor: Remove JSAPI databar code (#1758)
Browse files Browse the repository at this point in the history
Removing databar specific JSAPI code since this API will be moved to
dh.ui at some point
  • Loading branch information
mattrunyon authored Jan 31, 2024
1 parent 228f34d commit cfbbe74
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 71 deletions.
56 changes: 0 additions & 56 deletions packages/iris-grid/src/IrisGridTableModelTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import memoize from 'memoize-one';
import throttle from 'lodash.throttle';
import {
CellRenderType,
EditOperation,
GridRange,
GridUtils,
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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)) {
Expand Down
15 changes: 0 additions & 15 deletions packages/jsapi-types/src/dh.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cfbbe74

Please sign in to comment.