-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(xy): single point visibility (#2557)
* fix(xy): single point visibility * test(vrt): update screenshots [skip ci] --------- Co-authored-by: elastic-datavis[bot] <98618603+elastic-datavis[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d878992
commit e16c902
Showing
5 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
Binary file added
BIN
+22.2 KB
...s/all.test.ts-snapshots/baselines/area-chart/test-single-point-chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { | ||
AreaSeries, | ||
Axis, | ||
Chart, | ||
Position, | ||
ScaleType, | ||
Settings, | ||
timeFormatter, | ||
LegendValue, | ||
LineSeries, | ||
} from '@elastic/charts'; | ||
import { KIBANA_METRICS } from '@elastic/charts/src/utils/data_samples/test_dataset_kibana'; | ||
|
||
import { ChartsStory } from '../../types'; | ||
import { useBaseTheme } from '../../use_base_theme'; | ||
|
||
const dateFormatter = timeFormatter('HH:mm'); | ||
const dataLow = KIBANA_METRICS.metrics.kibana_os_load.v1.data; | ||
|
||
export const Example: ChartsStory = (_, { title, description }) => ( | ||
<Chart title={title} description={description}> | ||
<Settings | ||
showLegend | ||
legendValues={[LegendValue.Count]} | ||
legendPosition={Position.Right} | ||
baseTheme={useBaseTheme()} | ||
xDomain={{ | ||
min: KIBANA_METRICS.metrics.kibana_os_load.v1.timeRange.min, | ||
max: KIBANA_METRICS.metrics.kibana_os_load.v1.timeRange.max, | ||
}} | ||
/> | ||
<Axis | ||
id="bottom" | ||
title="timestamp per 1 minute" | ||
position={Position.Bottom} | ||
showOverlappingTicks | ||
tickFormat={dateFormatter} | ||
/> | ||
<Axis | ||
id="left" | ||
title={KIBANA_METRICS.metrics.kibana_os_load.v1.metric.title} | ||
position={Position.Left} | ||
tickFormat={(d) => Number(d).toFixed(2)} | ||
/> | ||
<AreaSeries | ||
id="area 1 point" | ||
xScaleType={ScaleType.Time} | ||
yScaleType={ScaleType.Linear} | ||
xAccessor={0} | ||
yAccessors={[1]} | ||
fit={{ type: 'linear' }} | ||
data={[dataLow[20]]} | ||
color="#00BEB8" | ||
/> | ||
<AreaSeries | ||
id="area 2 points" | ||
xScaleType={ScaleType.Time} | ||
yScaleType={ScaleType.Linear} | ||
xAccessor={0} | ||
yAccessors={[1]} | ||
fit={{ type: 'linear' }} | ||
data={[dataLow[30], dataLow[45]]} | ||
color="#93E5E0" | ||
/> | ||
|
||
<LineSeries | ||
id="line 1 point" | ||
xScaleType={ScaleType.Time} | ||
yScaleType={ScaleType.Linear} | ||
xAccessor={0} | ||
yAccessors={[1]} | ||
fit={{ type: 'linear' }} | ||
data={[dataLow[60]]} | ||
color="#599DFF" | ||
/> | ||
<LineSeries | ||
id="line 2 points" | ||
xScaleType={ScaleType.Time} | ||
yScaleType={ScaleType.Linear} | ||
xAccessor={0} | ||
yAccessors={[1]} | ||
fit={{ type: 'linear' }} | ||
data={[dataLow[65], dataLow[85]]} | ||
color="#B4D5FF" | ||
/> | ||
</Chart> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters