Skip to content

Commit 1a6d931

Browse files
qn895kibanamachine
andauthored
[ML] Fix missing selected-interval styling for Explorer anomaly charts and mismatched scheduled markers styling (#100272) (#100479)
* [ML] Fix missing selected-interval sass * [ML] Only show interval box in explorer page and not in dashboard * [ML] Remove console * [ML] Move showSelectedInterval up * [ML] Update snapshot * [ML] Update styling of scheduled events to match and to be visible Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent 1385c70 commit 1a6d931

File tree

8 files changed

+25
-5
lines changed

8 files changed

+25
-5
lines changed

x-pack/plugins/ml/public/application/explorer/explorer_charts/_explorer_chart.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,17 @@
1212
opacity: 1;
1313
}
1414

15+
rect.selected-interval {
16+
fill: rgba(200, 200, 200, .1);
17+
stroke: $euiColorDarkShade;
18+
stroke-width: $euiSizeXS / 2;
19+
stroke-opacity: .8;
20+
}
21+
1522
rect.scheduled-event-marker {
1623
stroke-width: 1px;
17-
stroke: $euiColorLightShade;
18-
fill: $euiColorLightestShade;
24+
stroke: $euiColorDarkShade;
25+
fill: $euiColorLightShade;
1926
pointer-events: none;
2027
}
2128
}

x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_anomalies_container.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface ExplorerAnomaliesContainerProps {
3131
timeBuckets: TimeBuckets;
3232
timefilter: TimefilterContract;
3333
onSelectEntity: (fieldName: string, fieldValue: string, operation: EntityFieldOperation) => void;
34+
showSelectedInterval?: boolean;
3435
}
3536

3637
const tooManyBucketsCalloutMsg = i18n.translate(
@@ -51,6 +52,7 @@ export const ExplorerAnomaliesContainer: FC<ExplorerAnomaliesContainerProps> = (
5152
timeBuckets,
5253
timefilter,
5354
onSelectEntity,
55+
showSelectedInterval,
5456
}) => {
5557
return (
5658
<>
@@ -96,6 +98,7 @@ export const ExplorerAnomaliesContainer: FC<ExplorerAnomaliesContainerProps> = (
9698
timefilter,
9799
onSelectEntity,
98100
tooManyBucketsCalloutMsg,
101+
showSelectedInterval,
99102
}}
100103
/>
101104
)}

x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class ExplorerChartDistribution extends React.Component {
6262
}
6363

6464
renderChart() {
65-
const { tooManyBuckets, tooltipService, timeBuckets } = this.props;
65+
const { tooManyBuckets, tooltipService, timeBuckets, showSelectedInterval } = this.props;
6666

6767
const element = this.rootNode;
6868
const config = this.props.seriesConfig;
@@ -357,6 +357,7 @@ export class ExplorerChartDistribution extends React.Component {
357357
}
358358

359359
function drawRareChartHighlightedSpan() {
360+
if (showSelectedInterval === false) return;
360361
// Draws a rectangle which highlights the time span that has been selected for view.
361362
// Note depending on the overall time range and the bucket span, the selected time
362363
// span may be longer than the range actually being plotted.

x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class ExplorerChartSingleMetric extends React.Component {
6161
}
6262

6363
renderChart() {
64-
const { tooManyBuckets, tooltipService, timeBuckets } = this.props;
64+
const { tooManyBuckets, tooltipService, timeBuckets, showSelectedInterval } = this.props;
6565

6666
const element = this.rootNode;
6767
const config = this.props.seriesConfig;
@@ -249,6 +249,8 @@ export class ExplorerChartSingleMetric extends React.Component {
249249
}
250250

251251
function drawLineChartHighlightedSpan() {
252+
if (showSelectedInterval === false) return;
253+
252254
// Draws a rectangle which highlights the time span that has been selected for view.
253255
// Note depending on the overall time range and the bucket span, the selected time
254256
// span may be longer than the range actually being plotted.

x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function ExplorerChartContainer({
7272
onSelectEntity,
7373
recentlyAccessed,
7474
tooManyBucketsCalloutMsg,
75+
showSelectedInterval,
7576
}) {
7677
const [explorerSeriesLink, setExplorerSeriesLink] = useState('');
7778

@@ -199,6 +200,7 @@ function ExplorerChartContainer({
199200
seriesConfig={series}
200201
severity={severity}
201202
tooltipService={tooltipService}
203+
showSelectedInterval={showSelectedInterval}
202204
/>
203205
)}
204206
</MlTooltipComponent>
@@ -214,6 +216,7 @@ function ExplorerChartContainer({
214216
seriesConfig={series}
215217
severity={severity}
216218
tooltipService={tooltipService}
219+
showSelectedInterval={showSelectedInterval}
217220
/>
218221
)}
219222
</MlTooltipComponent>
@@ -237,6 +240,7 @@ export const ExplorerChartsContainerUI = ({
237240
timefilter,
238241
onSelectEntity,
239242
tooManyBucketsCalloutMsg,
243+
showSelectedInterval,
240244
}) => {
241245
const {
242246
services: {
@@ -296,6 +300,7 @@ export const ExplorerChartsContainerUI = ({
296300
onSelectEntity={onSelectEntity}
297301
recentlyAccessed={recentlyAccessed}
298302
tooManyBucketsCalloutMsg={tooManyBucketsCalloutMsg}
303+
showSelectedInterval={showSelectedInterval}
299304
/>
300305
</EuiFlexItem>
301306
))}

x-pack/plugins/ml/public/application/timeseriesexplorer/_timeseriesexplorer.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133

134134
rect.scheduled-event-marker {
135135
stroke-width: 1px;
136-
stroke: $euiColorMediumShade;
136+
stroke: $euiColorDarkShade;
137137
fill: $euiColorLightShade;
138138
pointer-events: none;
139139
}

x-pack/plugins/ml/public/embeddables/anomaly_charts/__snapshots__/embeddable_anomaly_charts_container.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/ml/public/embeddables/anomaly_charts/embeddable_anomaly_charts_container.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export const EmbeddableAnomalyChartsContainer: FC<EmbeddableAnomalyChartsContain
181181
timeBuckets={timeBuckets}
182182
timefilter={timefilter}
183183
onSelectEntity={addEntityFieldFilter}
184+
showSelectedInterval={false}
184185
/>
185186
)}
186187
</div>

0 commit comments

Comments
 (0)