mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[ML] Replace Legacy Base Theme Usage (#216307)](https://github.com/elastic/kibana/pull/216307) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Robert Jaszczurek","email":"92210485+rbrtj@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-02T12:47:42Z","message":"[ML] Replace Legacy Base Theme Usage (#216307)\n\nFix for: https://github.com/elastic/kibana/issues/213974\nReplacing legacy base theme with appropriate theme from the charts hook.\n\n\n| Before | After |\n| ------------- | ------------- |\n| <img width=\"404\" alt=\"decision_path_before_light\"\nsrc=\"https://github.com/user-attachments/assets/217cb07d-65a2-4ac0-948b-9950af1e2663\"\n/> |\n\n| <img width=\"403\" alt=\"decision_path_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/5fc47999-e8c6-48f1-9293-03f23ce437e0\"\n/> |\n| <img width=\"769\" alt=\"feature_importance_before_light\"\nsrc=\"https://github.com/user-attachments/assets/6d25f980-0dd2-4a6a-a43f-450afa76fa62\"\n/> |\n\n|\n| <img width=\"767\" alt=\"feature_importance_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/db7eb5d7-80b3-49fa-99a5-1ae204fdbcc6\"\n/> |\n\n|\n| <img width=\"536\" alt=\"datafeed_chart_before_light\"\nsrc=\"https://github.com/user-attachments/assets/a5230c96-50f4-4754-a09f-8fe429da5f8d\"\n/> | <img width=\"728\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/12d37527-cdec-410c-a8db-3c1176a6e1c9\"\n/> |\n| <img width=\"497\" alt=\"datafeed_chart_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/3db9a313-baed-4abd-9cec-33abffcfd9d9\"\n/> | <img width=\"732\" alt=\"datafeed_chart_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/b8bf681a-f873-43a7-ad2d-2775ae91d4e3\"\n/> |\n| <img width=\"813\" alt=\"anomaly_chart_before_light\"\nsrc=\"https://github.com/user-attachments/assets/cf7cab54-513f-40dc-bb28-dbb7d93850b5\"\n/> | <img width=\"805\" alt=\"anomaly_chart_after_light\"\nsrc=\"https://github.com/user-attachments/assets/25b95962-00ec-4066-895a-71ee771609c9\"\n/> |\n| <img width=\"795\" alt=\"anomaly_chart_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/a87e2f8e-b871-409a-9485-9b05a5195025\"\n/> | <img width=\"802\" alt=\"anomaly_chart_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/ac27f414-c5fa-409b-b289-4f629de4e729\"\n/> |\n| <img width=\"799\" alt=\"event_rate_chart_before_light\"\nsrc=\"https://github.com/user-attachments/assets/346fdfaf-4c71-4e1d-ad72-ac3ef8abde32\"\n/> | <img width=\"801\" alt=\"event_rate_chart_after_light\"\nsrc=\"https://github.com/user-attachments/assets/23a14bee-bd89-4dea-ad67-c29116e7e275\"\n/> |\n| <img width=\"797\" alt=\"event_rate_chart_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/7c255206-299c-4dfd-9134-06517f82ba23\"\n/> | <img width=\"810\" alt=\"event_rate_chart_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/6f2c912e-cdeb-4be4-84a1-1520eec65d01\"\n/> |","sha":"62a1589ed1cf4769a76ac2999cc18182a9b23dfa","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","release_note:skip","Team:ML","backport:version","v9.1.0","v8.19.0"],"title":"[ML] Replace Legacy Base Theme Usage","number":216307,"url":"https://github.com/elastic/kibana/pull/216307","mergeCommit":{"message":"[ML] Replace Legacy Base Theme Usage (#216307)\n\nFix for: https://github.com/elastic/kibana/issues/213974\nReplacing legacy base theme with appropriate theme from the charts hook.\n\n\n| Before | After |\n| ------------- | ------------- |\n| <img width=\"404\" alt=\"decision_path_before_light\"\nsrc=\"https://github.com/user-attachments/assets/217cb07d-65a2-4ac0-948b-9950af1e2663\"\n/> |\n\n| <img width=\"403\" alt=\"decision_path_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/5fc47999-e8c6-48f1-9293-03f23ce437e0\"\n/> |\n| <img width=\"769\" alt=\"feature_importance_before_light\"\nsrc=\"https://github.com/user-attachments/assets/6d25f980-0dd2-4a6a-a43f-450afa76fa62\"\n/> |\n\n|\n| <img width=\"767\" alt=\"feature_importance_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/db7eb5d7-80b3-49fa-99a5-1ae204fdbcc6\"\n/> |\n\n|\n| <img width=\"536\" alt=\"datafeed_chart_before_light\"\nsrc=\"https://github.com/user-attachments/assets/a5230c96-50f4-4754-a09f-8fe429da5f8d\"\n/> | <img width=\"728\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/12d37527-cdec-410c-a8db-3c1176a6e1c9\"\n/> |\n| <img width=\"497\" alt=\"datafeed_chart_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/3db9a313-baed-4abd-9cec-33abffcfd9d9\"\n/> | <img width=\"732\" alt=\"datafeed_chart_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/b8bf681a-f873-43a7-ad2d-2775ae91d4e3\"\n/> |\n| <img width=\"813\" alt=\"anomaly_chart_before_light\"\nsrc=\"https://github.com/user-attachments/assets/cf7cab54-513f-40dc-bb28-dbb7d93850b5\"\n/> | <img width=\"805\" alt=\"anomaly_chart_after_light\"\nsrc=\"https://github.com/user-attachments/assets/25b95962-00ec-4066-895a-71ee771609c9\"\n/> |\n| <img width=\"795\" alt=\"anomaly_chart_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/a87e2f8e-b871-409a-9485-9b05a5195025\"\n/> | <img width=\"802\" alt=\"anomaly_chart_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/ac27f414-c5fa-409b-b289-4f629de4e729\"\n/> |\n| <img width=\"799\" alt=\"event_rate_chart_before_light\"\nsrc=\"https://github.com/user-attachments/assets/346fdfaf-4c71-4e1d-ad72-ac3ef8abde32\"\n/> | <img width=\"801\" alt=\"event_rate_chart_after_light\"\nsrc=\"https://github.com/user-attachments/assets/23a14bee-bd89-4dea-ad67-c29116e7e275\"\n/> |\n| <img width=\"797\" alt=\"event_rate_chart_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/7c255206-299c-4dfd-9134-06517f82ba23\"\n/> | <img width=\"810\" alt=\"event_rate_chart_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/6f2c912e-cdeb-4be4-84a1-1520eec65d01\"\n/> |","sha":"62a1589ed1cf4769a76ac2999cc18182a9b23dfa"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216307","number":216307,"mergeCommit":{"message":"[ML] Replace Legacy Base Theme Usage (#216307)\n\nFix for: https://github.com/elastic/kibana/issues/213974\nReplacing legacy base theme with appropriate theme from the charts hook.\n\n\n| Before | After |\n| ------------- | ------------- |\n| <img width=\"404\" alt=\"decision_path_before_light\"\nsrc=\"https://github.com/user-attachments/assets/217cb07d-65a2-4ac0-948b-9950af1e2663\"\n/> |\n\n| <img width=\"403\" alt=\"decision_path_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/5fc47999-e8c6-48f1-9293-03f23ce437e0\"\n/> |\n| <img width=\"769\" alt=\"feature_importance_before_light\"\nsrc=\"https://github.com/user-attachments/assets/6d25f980-0dd2-4a6a-a43f-450afa76fa62\"\n/> |\n\n|\n| <img width=\"767\" alt=\"feature_importance_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/db7eb5d7-80b3-49fa-99a5-1ae204fdbcc6\"\n/> |\n\n|\n| <img width=\"536\" alt=\"datafeed_chart_before_light\"\nsrc=\"https://github.com/user-attachments/assets/a5230c96-50f4-4754-a09f-8fe429da5f8d\"\n/> | <img width=\"728\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/12d37527-cdec-410c-a8db-3c1176a6e1c9\"\n/> |\n| <img width=\"497\" alt=\"datafeed_chart_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/3db9a313-baed-4abd-9cec-33abffcfd9d9\"\n/> | <img width=\"732\" alt=\"datafeed_chart_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/b8bf681a-f873-43a7-ad2d-2775ae91d4e3\"\n/> |\n| <img width=\"813\" alt=\"anomaly_chart_before_light\"\nsrc=\"https://github.com/user-attachments/assets/cf7cab54-513f-40dc-bb28-dbb7d93850b5\"\n/> | <img width=\"805\" alt=\"anomaly_chart_after_light\"\nsrc=\"https://github.com/user-attachments/assets/25b95962-00ec-4066-895a-71ee771609c9\"\n/> |\n| <img width=\"795\" alt=\"anomaly_chart_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/a87e2f8e-b871-409a-9485-9b05a5195025\"\n/> | <img width=\"802\" alt=\"anomaly_chart_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/ac27f414-c5fa-409b-b289-4f629de4e729\"\n/> |\n| <img width=\"799\" alt=\"event_rate_chart_before_light\"\nsrc=\"https://github.com/user-attachments/assets/346fdfaf-4c71-4e1d-ad72-ac3ef8abde32\"\n/> | <img width=\"801\" alt=\"event_rate_chart_after_light\"\nsrc=\"https://github.com/user-attachments/assets/23a14bee-bd89-4dea-ad67-c29116e7e275\"\n/> |\n| <img width=\"797\" alt=\"event_rate_chart_before_dark\"\nsrc=\"https://github.com/user-attachments/assets/7c255206-299c-4dfd-9134-06517f82ba23\"\n/> | <img width=\"810\" alt=\"event_rate_chart_after_dark\"\nsrc=\"https://github.com/user-attachments/assets/6f2c912e-cdeb-4be4-84a1-1520eec65d01\"\n/> |","sha":"62a1589ed1cf4769a76ac2999cc18182a9b23dfa"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
3d43f2886b
commit
37f5562b73
6 changed files with 165 additions and 108 deletions
|
@ -21,53 +21,18 @@ import {
|
|||
Position,
|
||||
ScaleType,
|
||||
Settings,
|
||||
LEGACY_LIGHT_THEME,
|
||||
} from '@elastic/charts';
|
||||
import { EuiIcon } from '@elastic/eui';
|
||||
import { EuiIcon, useEuiTheme } from '@elastic/eui';
|
||||
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { euiLightVars as euiVars } from '@kbn/ui-theme';
|
||||
import {
|
||||
type FeatureImportanceBaseline,
|
||||
isRegressionFeatureImportanceBaseline,
|
||||
} from '@kbn/ml-data-frame-analytics-utils';
|
||||
import { useMlKibana } from '../../../../../contexts/kibana';
|
||||
import type { DecisionPathPlotData } from './use_classification_path_data';
|
||||
import { formatSingleValue } from '../../../../../formatters/format_value';
|
||||
const { euiColorFullShade, euiColorMediumShade } = euiVars;
|
||||
const axisColor = euiColorMediumShade;
|
||||
|
||||
const baselineStyle: LineAnnotationStyle = {
|
||||
line: {
|
||||
strokeWidth: 1,
|
||||
stroke: euiColorFullShade,
|
||||
opacity: 0.75,
|
||||
},
|
||||
};
|
||||
|
||||
const axes: RecursivePartial<AxisStyle> = {
|
||||
axisLine: {
|
||||
stroke: axisColor,
|
||||
},
|
||||
tickLabel: {
|
||||
fontSize: 10,
|
||||
fill: axisColor,
|
||||
},
|
||||
tickLine: {
|
||||
stroke: axisColor,
|
||||
},
|
||||
gridLine: {
|
||||
horizontal: {
|
||||
dash: [1, 2],
|
||||
},
|
||||
vertical: {
|
||||
strokeWidth: 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
const theme: PartialTheme = {
|
||||
axes,
|
||||
};
|
||||
|
||||
interface DecisionPathChartProps {
|
||||
decisionPathData: DecisionPathPlotData;
|
||||
|
@ -88,6 +53,73 @@ export const DecisionPathChart = ({
|
|||
maxDomain,
|
||||
baseline,
|
||||
}: DecisionPathChartProps) => {
|
||||
const {
|
||||
services: {
|
||||
charts: {
|
||||
theme: { useChartsBaseTheme },
|
||||
},
|
||||
},
|
||||
} = useMlKibana();
|
||||
|
||||
const { euiTheme } = useEuiTheme();
|
||||
|
||||
const baseTheme = useChartsBaseTheme();
|
||||
|
||||
const { baselineStyle, theme } = useMemo<{
|
||||
baselineStyle: LineAnnotationStyle;
|
||||
theme: PartialTheme;
|
||||
}>(() => {
|
||||
const euiColorFullShade = euiTheme.colors.fullShade;
|
||||
const euiColorMediumShade = euiTheme.colors.mediumShade;
|
||||
const axisColor = euiColorMediumShade;
|
||||
|
||||
const axes: RecursivePartial<AxisStyle> = {
|
||||
axisLine: {
|
||||
stroke: axisColor,
|
||||
},
|
||||
tickLabel: {
|
||||
fontSize: 10,
|
||||
fill: axisColor,
|
||||
},
|
||||
tickLine: {
|
||||
stroke: axisColor,
|
||||
},
|
||||
gridLine: {
|
||||
horizontal: {
|
||||
dash: [1, 2],
|
||||
},
|
||||
vertical: {
|
||||
strokeWidth: 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
baselineStyle: {
|
||||
line: {
|
||||
strokeWidth: 1,
|
||||
stroke: euiColorFullShade,
|
||||
opacity: 0.75,
|
||||
},
|
||||
},
|
||||
theme: {
|
||||
axes,
|
||||
lineSeriesStyle: {
|
||||
line: {
|
||||
visible: true,
|
||||
strokeWidth: 1,
|
||||
},
|
||||
point: {
|
||||
visible: 'always',
|
||||
},
|
||||
},
|
||||
chartMargins: {
|
||||
top: 10,
|
||||
},
|
||||
},
|
||||
};
|
||||
}, [euiTheme]);
|
||||
|
||||
const regressionBaselineData: LineAnnotationDatum[] | undefined = useMemo(
|
||||
() =>
|
||||
baseline && isRegressionFeatureImportanceBaseline(baseline)
|
||||
|
@ -129,13 +161,7 @@ export const DecisionPathChart = ({
|
|||
<Chart
|
||||
size={{ height: DECISION_PATH_MARGIN + decisionPathData.length * DECISION_PATH_ROW_HEIGHT }}
|
||||
>
|
||||
<Settings
|
||||
theme={theme}
|
||||
// TODO connect to charts.theme service see src/plugins/charts/public/services/theme/README.md
|
||||
baseTheme={LEGACY_LIGHT_THEME}
|
||||
rotation={90}
|
||||
locale={i18n.getLocale()}
|
||||
/>
|
||||
<Settings theme={theme} baseTheme={baseTheme} rotation={90} locale={i18n.getLocale()} />
|
||||
{regressionBaselineData && (
|
||||
<LineAnnotation
|
||||
id="xpack.ml.dataframe.analytics.explorationResults.decisionPathBaseline"
|
||||
|
|
|
@ -8,21 +8,12 @@
|
|||
import type { FC } from 'react';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
|
||||
import { EuiButtonEmpty, EuiSpacer, EuiText, EuiCallOut } from '@elastic/eui';
|
||||
import { EuiButtonEmpty, EuiSpacer, EuiText, EuiCallOut, useEuiTheme } from '@elastic/eui';
|
||||
import type { RecursivePartial, AxisStyle, PartialTheme, BarSeriesProps } from '@elastic/charts';
|
||||
import {
|
||||
Chart,
|
||||
Settings,
|
||||
Axis,
|
||||
ScaleType,
|
||||
Position,
|
||||
BarSeries,
|
||||
LEGACY_LIGHT_THEME,
|
||||
} from '@elastic/charts';
|
||||
import { Chart, Settings, Axis, ScaleType, Position, BarSeries } from '@elastic/charts';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { euiLightVars as euiVars } from '@kbn/ui-theme';
|
||||
import {
|
||||
getAnalysisType,
|
||||
isClassificationAnalysis,
|
||||
|
@ -40,40 +31,6 @@ import { useMlKibana } from '../../../../../contexts/kibana';
|
|||
|
||||
import { ExpandableSection } from '../expandable_section';
|
||||
|
||||
const { euiColorMediumShade } = euiVars;
|
||||
const axisColor = euiColorMediumShade;
|
||||
|
||||
const axes: RecursivePartial<AxisStyle> = {
|
||||
axisLine: {
|
||||
stroke: axisColor,
|
||||
},
|
||||
tickLabel: {
|
||||
fontSize: 12,
|
||||
fill: axisColor,
|
||||
},
|
||||
tickLine: {
|
||||
stroke: axisColor,
|
||||
},
|
||||
gridLine: {
|
||||
horizontal: {
|
||||
dash: [1, 2],
|
||||
},
|
||||
vertical: {
|
||||
strokeWidth: 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
const theme: PartialTheme = {
|
||||
axes,
|
||||
legend: {
|
||||
/**
|
||||
* Added buffer between label and value.
|
||||
* Smaller values render a more compact legend
|
||||
*/
|
||||
spacingBuffer: 100,
|
||||
},
|
||||
};
|
||||
|
||||
export interface FeatureImportanceSummaryPanelProps {
|
||||
totalFeatureImportance: TotalFeatureImportance[];
|
||||
jobConfig: DataFrameAnalyticsConfig;
|
||||
|
@ -98,8 +55,14 @@ export const FeatureImportanceSummaryPanel: FC<FeatureImportanceSummaryPanelProp
|
|||
totalFeatureImportance,
|
||||
jobConfig,
|
||||
}) => {
|
||||
const { euiTheme } = useEuiTheme();
|
||||
const {
|
||||
services: { docLinks },
|
||||
services: {
|
||||
docLinks,
|
||||
charts: {
|
||||
theme: { useChartsBaseTheme },
|
||||
},
|
||||
},
|
||||
} = useMlKibana();
|
||||
|
||||
interface Datum {
|
||||
|
@ -109,6 +72,46 @@ export const FeatureImportanceSummaryPanel: FC<FeatureImportanceSummaryPanelProp
|
|||
}
|
||||
type PlotData = Datum[];
|
||||
type SeriesProps = Omit<BarSeriesProps, 'id' | 'xScaleType' | 'yScaleType' | 'data'>;
|
||||
|
||||
const baseTheme = useChartsBaseTheme();
|
||||
|
||||
const theme: PartialTheme = useMemo(() => {
|
||||
const euiColorMediumShade = euiTheme.colors.mediumShade;
|
||||
const axisColor = euiColorMediumShade;
|
||||
|
||||
const axes: RecursivePartial<AxisStyle> = {
|
||||
axisLine: {
|
||||
stroke: axisColor,
|
||||
},
|
||||
tickLabel: {
|
||||
fontSize: 12,
|
||||
fill: axisColor,
|
||||
},
|
||||
tickLine: {
|
||||
stroke: axisColor,
|
||||
},
|
||||
gridLine: {
|
||||
horizontal: {
|
||||
dash: [1, 2],
|
||||
},
|
||||
vertical: {
|
||||
strokeWidth: 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
axes,
|
||||
legend: {
|
||||
/**
|
||||
* Added buffer between label and value.
|
||||
* Smaller values render a more compact legend
|
||||
*/
|
||||
spacingBuffer: 100,
|
||||
},
|
||||
};
|
||||
}, [euiTheme]);
|
||||
|
||||
const [plotData, barSeriesSpec, showLegend, chartHeight] = useMemo<
|
||||
[plotData: PlotData, barSeriesSpec: SeriesProps, showLegend?: boolean, chartHeight?: number]
|
||||
>(() => {
|
||||
|
@ -295,8 +298,7 @@ export const FeatureImportanceSummaryPanel: FC<FeatureImportanceSummaryPanelProp
|
|||
<Settings
|
||||
rotation={90}
|
||||
theme={theme}
|
||||
// TODO connect to charts.theme service see src/plugins/charts/public/services/theme/README.md
|
||||
baseTheme={LEGACY_LIGHT_THEME}
|
||||
baseTheme={baseTheme}
|
||||
showLegend={showLegend}
|
||||
locale={i18n.getLocale()}
|
||||
/>
|
||||
|
|
|
@ -40,7 +40,6 @@ import {
|
|||
Axis,
|
||||
Chart,
|
||||
CurveType,
|
||||
LEGACY_LIGHT_THEME,
|
||||
LineAnnotation,
|
||||
LineSeries,
|
||||
Position,
|
||||
|
@ -61,7 +60,7 @@ import type {
|
|||
import type { JobMessage } from '../../../../../../common/types/audit_message';
|
||||
import type { LineAnnotationDatumWithModelSnapshot } from '../../../../../../common/types/results';
|
||||
import { useToastNotificationService } from '../../../../services/toast_notification_service';
|
||||
import { useCurrentThemeVars, useMlApi } from '../../../../contexts/kibana';
|
||||
import { useCurrentThemeVars, useMlApi, useMlKibana } from '../../../../contexts/kibana';
|
||||
import { RevertModelSnapshotFlyout } from '../../../../components/model_snapshots/revert_model_snapshot_flyout';
|
||||
import { JobMessagesPane } from '../job_details/job_messages_pane';
|
||||
import { EditQueryDelay } from './edit_query_delay';
|
||||
|
@ -142,6 +141,16 @@ export const DatafeedChartFlyout: FC<DatafeedChartFlyoutProps> = ({
|
|||
const canCreateJob = useMemo(() => checkPermission('canCreateJob'), []);
|
||||
const canStartStopDatafeed = useMemo(() => checkPermission('canStartStopDatafeed'), []);
|
||||
|
||||
const {
|
||||
services: {
|
||||
charts: {
|
||||
theme: { useChartsBaseTheme },
|
||||
},
|
||||
},
|
||||
} = useMlKibana();
|
||||
|
||||
const baseTheme = useChartsBaseTheme();
|
||||
|
||||
const {
|
||||
getModelSnapshots,
|
||||
results: { getDatafeedResultChartData },
|
||||
|
@ -441,9 +450,11 @@ export const DatafeedChartFlyout: FC<DatafeedChartFlyoutProps> = ({
|
|||
visible: 'never',
|
||||
},
|
||||
},
|
||||
chartMargins: {
|
||||
top: 10,
|
||||
},
|
||||
}}
|
||||
// TODO connect to charts.theme service see src/plugins/charts/public/services/theme/README.md
|
||||
baseTheme={LEGACY_LIGHT_THEME}
|
||||
baseTheme={baseTheme}
|
||||
locale={i18n.getLocale()}
|
||||
/>
|
||||
<Axis
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
|
||||
import type { FC } from 'react';
|
||||
import React from 'react';
|
||||
import { Chart, Settings, TooltipType, Tooltip, LEGACY_LIGHT_THEME } from '@elastic/charts';
|
||||
import { Chart, Settings, TooltipType, Tooltip } from '@elastic/charts';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { useMlKibana } from '../../../../../../contexts/kibana';
|
||||
import type { ModelItem, Anomaly } from '../../../../common/results_loader';
|
||||
import { Anomalies } from '../common/anomalies';
|
||||
import { ModelBounds } from './model_bounds';
|
||||
|
@ -43,6 +44,16 @@ export const AnomalyChart: FC<Props> = ({
|
|||
width,
|
||||
loading = false,
|
||||
}) => {
|
||||
const {
|
||||
services: {
|
||||
charts: {
|
||||
theme: { useChartsBaseTheme },
|
||||
},
|
||||
},
|
||||
} = useMlKibana();
|
||||
|
||||
const baseTheme = useChartsBaseTheme();
|
||||
|
||||
const data = chartType === CHART_TYPE.SCATTER ? flattenData(chartData) : chartData;
|
||||
const xDomain = getXRange(data);
|
||||
return (
|
||||
|
@ -50,12 +61,7 @@ export const AnomalyChart: FC<Props> = ({
|
|||
<LoadingWrapper height={height} hasData={data.length > 0} loading={loading}>
|
||||
<Chart>
|
||||
<Tooltip type={TooltipType.None} />
|
||||
<Settings
|
||||
// TODO connect to charts.theme service see src/plugins/charts/public/services/theme/README.md
|
||||
baseTheme={LEGACY_LIGHT_THEME}
|
||||
xDomain={xDomain}
|
||||
locale={i18n.getLocale()}
|
||||
/>
|
||||
<Settings baseTheme={baseTheme} xDomain={xDomain} locale={i18n.getLocale()} />
|
||||
<Axes chartData={data} />
|
||||
<Anomalies anomalyData={anomalyData} />
|
||||
<ModelBounds modelData={modelData} />
|
||||
|
|
|
@ -15,10 +15,10 @@ import {
|
|||
Settings,
|
||||
TooltipType,
|
||||
Tooltip,
|
||||
LEGACY_LIGHT_THEME,
|
||||
} from '@elastic/charts';
|
||||
import { css } from '@emotion/react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { useMlKibana } from '../../../../../../contexts/kibana';
|
||||
import { Axes } from '../common/axes';
|
||||
import type { LineChartPoint } from '../../../../common/chart_loader';
|
||||
import type { Anomaly } from '../../../../common/results_loader';
|
||||
|
@ -55,6 +55,16 @@ export const EventRateChart: FC<Props> = ({
|
|||
overlayRanges,
|
||||
onBrushEnd,
|
||||
}) => {
|
||||
const {
|
||||
services: {
|
||||
charts: {
|
||||
theme: { useChartsBaseTheme },
|
||||
},
|
||||
},
|
||||
} = useMlKibana();
|
||||
|
||||
const baseTheme = useChartsBaseTheme();
|
||||
|
||||
const { EVENT_RATE_COLOR_WITH_ANOMALIES, EVENT_RATE_COLOR } = useChartColors();
|
||||
const barColor = fadeChart ? EVENT_RATE_COLOR_WITH_ANOMALIES : EVENT_RATE_COLOR;
|
||||
|
||||
|
@ -79,8 +89,7 @@ export const EventRateChart: FC<Props> = ({
|
|||
<Settings
|
||||
onBrushEnd={onBrushEnd}
|
||||
theme={theme}
|
||||
// TODO connect to charts.theme service see src/plugins/charts/public/services/theme/README.md
|
||||
baseTheme={LEGACY_LIGHT_THEME}
|
||||
baseTheme={baseTheme}
|
||||
locale={i18n.getLocale()}
|
||||
/>
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
EuiHorizontalRule,
|
||||
EuiSpacer,
|
||||
useEuiTheme,
|
||||
COLOR_MODES_STANDARD,
|
||||
} from '@elastic/eui';
|
||||
import type { SplitField } from '@kbn/ml-anomaly-utils';
|
||||
import { JOB_TYPE } from '../../../../../../../../../common/constants/new_job';
|
||||
|
@ -34,11 +35,13 @@ interface Panel {
|
|||
|
||||
export const SplitCards: FC<PropsWithChildren<Props>> = memo(
|
||||
({ fieldValues, splitField, children, numberOfDetectors, jobType, animate = false }) => {
|
||||
const { euiTheme } = useEuiTheme();
|
||||
const { euiTheme, colorMode } = useEuiTheme();
|
||||
const panels: Panel[] = [];
|
||||
|
||||
const isLightTheme = colorMode === COLOR_MODES_STANDARD.light;
|
||||
|
||||
const splitCardStyle = {
|
||||
border: euiTheme.border.thin,
|
||||
...(isLightTheme ? { border: euiTheme.border.thin } : {}),
|
||||
paddingTop: euiTheme.size.xs,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue