[ML] Fix legend text colors for Vega based charts in dark mode. (#115911)

Fixes the legend text colors for Vega based charts in dark mode.
This commit is contained in:
Walter Rafelsberger 2021-10-25 11:50:35 +02:00 committed by GitHub
parent d66abdf25e
commit ed99e2466a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

View file

@ -107,6 +107,11 @@ export const getScatterplotMatrixVegaLiteSpec = (
labelColor: euiTheme.euiTextSubduedColor,
titleColor: euiTheme.euiTextSubduedColor,
},
legend: {
orient: 'right',
labelColor: euiTheme.euiTextSubduedColor,
titleColor: euiTheme.euiTextSubduedColor,
},
},
repeat: {
column: vegaColumns,

View file

@ -26,6 +26,7 @@ import { useMlKibana } from '../../../../../contexts/kibana';
// Separate imports for lazy loadable VegaChart and related code
import { VegaChart } from '../../../../../components/vega_chart';
import { VegaChartLoading } from '../../../../../components/vega_chart/vega_chart_loading';
import { useCurrentEuiTheme } from '../../../../../components/color_range_legend';
import { ErrorCallout } from '../error_callout';
import { getDependentVar, DataFrameAnalyticsConfig } from '../../../../common';
@ -33,6 +34,7 @@ import { DataFrameTaskStateType } from '../../../analytics_management/components
import { ResultsSearchQuery } from '../../../../common/analytics';
import { ExpandableSection, HEADER_ITEMS_LOADING } from '../expandable_section';
import { EvaluateStat } from './evaluate_stat';
import { EvaluationQualityMetricsTable } from './evaluation_quality_metrics_table';
@ -107,6 +109,7 @@ export const EvaluatePanel: FC<EvaluatePanelProps> = ({ jobConfig, jobStatus, se
const {
services: { docLinks },
} = useMlKibana();
const { euiTheme } = useCurrentEuiTheme();
const [columns, setColumns] = useState<ConfusionMatrixColumn[]>([]);
const [columnsData, setColumnsData] = useState<ConfusionMatrixColumnData[]>([]);
@ -469,7 +472,8 @@ export const EvaluatePanel: FC<EvaluatePanelProps> = ({ jobConfig, jobStatus, se
vegaSpec={getRocCurveChartVegaLiteSpec(
classificationClasses,
rocCurveData,
getDependentVar(jobConfig.analysis)
getDependentVar(jobConfig.analysis),
euiTheme
)}
/>
</div>

View file

@ -10,6 +10,7 @@
import type { TopLevelSpec } from 'vega-lite/build/vega-lite';
import { euiPaletteColorBlind, euiPaletteGray } from '@elastic/eui';
import euiThemeLight from '@elastic/eui/dist/eui_theme_light.json';
import { i18n } from '@kbn/i18n';
@ -43,7 +44,8 @@ export interface RocCurveDataRow extends RocCurveItem {
export const getRocCurveChartVegaLiteSpec = (
classificationClasses: string[],
data: RocCurveDataRow[],
legendTitle: string
legendTitle: string,
euiTheme: typeof euiThemeLight
): TopLevelSpec => {
// we append two rows which make up the data for the diagonal baseline
data.push({ tpr: 0, fpr: 0, threshold: 1, class_name: BASELINE });
@ -59,6 +61,8 @@ export const getRocCurveChartVegaLiteSpec = (
config: {
legend: {
orient: 'right',
labelColor: euiTheme.euiTextSubduedColor,
titleColor: euiTheme.euiTextSubduedColor,
},
view: {
continuousHeight: SIZE,
@ -101,9 +105,9 @@ export const getRocCurveChartVegaLiteSpec = (
type: 'quantitative',
axis: {
tickColor: GRAY,
labelColor: GRAY,
labelColor: euiTheme.euiTextSubduedColor,
domainColor: GRAY,
titleColor: GRAY,
titleColor: euiTheme.euiTextSubduedColor,
},
},
y: {
@ -114,9 +118,9 @@ export const getRocCurveChartVegaLiteSpec = (
type: 'quantitative',
axis: {
tickColor: GRAY,
labelColor: GRAY,
labelColor: euiTheme.euiTextSubduedColor,
domainColor: GRAY,
titleColor: GRAY,
titleColor: euiTheme.euiTextSubduedColor,
},
},
tooltip: [

View file

@ -53,7 +53,7 @@ export default function ({ getService }: FtrProviderContext) {
// tick/grid/axis
{ color: '#DDDDDD', percentage: 50 },
// line
{ color: '#98A2B3', percentage: 30 },
{ color: '#98A2B3', percentage: 10 },
],
scatterplotMatrixColorStats: [
// marker colors