Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/chart/src/ChartTheme.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@
ocean-color: var(--dh-color-chart-geo-ocean);
lake-color: var(--dh-color-chart-geo-lake);
river-color: var(--dh-color-chart-geo-river);

/* Indicator */
indicator-increasing: var(--dh-color-chart-indicator-increase);
indicator-decreasing: var(--dh-color-chart-indicator-decrease);
indicator-gauge: var(--dh-color-chart-indicator-gauge);
}
9 changes: 9 additions & 0 deletions packages/chart/src/ChartTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export interface ChartTheme {
ocean_color: string;
lake_color: string;
river_color: string;

// Indicator
indicator_increasing: string;
indicator_decreasing: string;
indicator_gauge: string;
}

export function defaultChartTheme(): Readonly<ChartTheme> {
Expand Down Expand Up @@ -65,6 +70,10 @@ export function defaultChartTheme(): Readonly<ChartTheme> {
ocean_color: chartTheme['ocean-color'],
lake_color: chartTheme['lake-color'],
river_color: chartTheme['river-color'],
// Indicator
indicator_increasing: chartTheme['indicator-increasing'],
indicator_decreasing: chartTheme['indicator-decreasing'],
indicator_gauge: chartTheme['indicator-gauge'],
});
}

Expand Down
18 changes: 18 additions & 0 deletions packages/chart/src/ChartUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
AxisType as PlotlyAxisType,
MarkerSymbol,
Template,
Delta,
} from 'plotly.js';
import { assertNotNull, bindAllMethods, type Range } from '@deephaven/utils';
import { type ChartTheme } from './ChartTheme';
Expand Down Expand Up @@ -2038,6 +2039,9 @@ class ChartUtils {
ohlc_increasing,
ohlc_decreasing,
title_color,
indicator_increasing,
indicator_decreasing,
indicator_gauge,
} = theme;

return {
Expand Down Expand Up @@ -2075,6 +2079,20 @@ class ChartUtils {
},
},
],
indicator: [
{
title: { font: { color: title_color } },
delta: {
decreasing: {
color: indicator_decreasing,
} as Delta['increasing'],
increasing: {
color: indicator_increasing,
} as Delta['decreasing'],
},
gauge: { bar: { color: indicator_gauge } },
},
],
},
/* eslint-enable camelcase */
layout: this.makeDefaultLayout(theme),
Expand Down
3 changes: 3 additions & 0 deletions packages/chart/src/__snapshots__/ChartTheme.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ exports[`defaultChartTheme should create the default chart theme 1`] = `
"colorway": "chartTheme['colorway']",
"error_band_line_color": "chartTheme['error-band-line-color']",
"gridcolor": "chartTheme['gridcolor']",
"indicator_decreasing": "chartTheme['indicator-decreasing']",
"indicator_gauge": "chartTheme['indicator-gauge']",
"indicator_increasing": "chartTheme['indicator-increasing']",
"lake_color": "chartTheme['lake-color']",
"land_color": "chartTheme['land-color']",
"legend_color": "chartTheme['legend-color']",
Expand Down
22 changes: 22 additions & 0 deletions packages/chart/src/__snapshots__/ChartUtils.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ exports[`makeDefaultTemplate should create a default template 1`] = `
},
},
],
"indicator": [
{
"delta": {
"decreasing": {
"color": "ChartTheme['indicator_decreasing']",
},
"increasing": {
"color": "ChartTheme['indicator_increasing']",
},
},
"gauge": {
"bar": {
"color": "ChartTheme['indicator_gauge']",
},
},
"title": {
"font": {
"color": "ChartTheme['title_color']",
},
},
},
],
"ohlc": [
{
"decreasing": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@
--dh-color-chart-geo-ocean: var(--dh-color-gray-300);
--dh-color-chart-geo-lake: var(--dh-color-blue-200);
--dh-color-chart-geo-river: var(--dh-color-blue-200);

/* Indicator */
--dh-color-chart-indicator-increase: var(--dh-color-visual-green);
--dh-color-chart-indicator-decrease: var(--dh-color-visual-red);
--dh-color-chart-indicator-gauge: var(--dh-color-green-1000);
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@
--dh-color-chart-geo-ocean: var(--dh-color-gray-300);
--dh-color-chart-geo-lake: var(--dh-color-blue-400);
--dh-color-chart-geo-river: var(--dh-color-blue-400);

/* Indicator */
--dh-color-chart-indicator-increase: var(--dh-color-visual-green);
--dh-color-chart-indicator-decrease: var(--dh-color-visual-red);
--dh-color-chart-indicator-gauge: var(--dh-color-green-1000);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/styleguide.spec.ts-snapshots/chart-colors-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.