Skip to content

Commit a0205f2

Browse files
committed
pass in textColor through databar
1 parent 66f6c00 commit a0205f2

4 files changed

Lines changed: 5 additions & 20 deletions

File tree

packages/grid/src/DataBarCellRenderer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class DataBarCellRenderer extends CellRenderer {
121121
columnMax,
122122
axis,
123123
color: dataBarColor,
124+
textColor,
124125
valuePlacement,
125126
opacity,
126127
markers,
@@ -147,11 +148,10 @@ class DataBarCellRenderer extends CellRenderer {
147148
context.save();
148149
context.textAlign = textAlign;
149150

150-
// Use explicit format color if set.
151+
// Use explicit text color if set.
151152
// Otherwise, fall back to the databar color for text.
152-
const formatColor = model.formatColorForCell(modelColumn, modelRow);
153-
if (formatColor != null) {
154-
context.fillStyle = formatColor;
153+
if (textColor != null) {
154+
context.fillStyle = textColor;
155155
} else if (hasGradient) {
156156
const color =
157157
value >= 0 ? dataBarColor[dataBarColor.length - 1] : dataBarColor[0];

packages/grid/src/DataBarGridModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export interface DataBarOptions {
3535
columnMax: number;
3636
axis: AxisOption;
3737
color: GridColor | GridColor[];
38+
textColor?: GridColor;
3839
valuePlacement: ValuePlacementOption;
3940
opacity: number;
4041
markers: Marker[];

packages/grid/src/GridModel.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,6 @@ abstract class GridModel<
110110
return theme.textColor;
111111
}
112112

113-
/**
114-
* Get the explicitly set format color for a cell
115-
* Unlike colorForCell, this only returns a color that was explicitly
116-
* set via formatting not type-based theme colors.
117-
* @param column Column to get the format color for
118-
* @param row Row to get the format color for
119-
* @returns Explicitly set format color, or null if none was set
120-
*/
121-
formatColorForCell(_column: ModelIndex, _row: ModelIndex): NullableGridColor {
122-
return null;
123-
}
124-
125113
/**
126114
* Get the background color for the cell
127115
* @param column Column to get the background color for

packages/iris-grid/src/IrisGridTableModelTemplate.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,10 +651,6 @@ class IrisGridTableModelTemplate<
651651
return theme.textColor;
652652
}
653653

654-
formatColorForCell(x: ModelIndex, y: ModelIndex): string | null {
655-
return this.formatForCell(x, y)?.color ?? null;
656-
}
657-
658654
backgroundColorForCell(
659655
x: ModelIndex,
660656
y: ModelIndex,

0 commit comments

Comments
 (0)