-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Series Charts] Provide custom crosshair overlay time formatting (#1429)
* Specify a date format prop for EuiSeriesChart's crosshair. * Add y crosshair formatting capabilities. * Sync with latest changelog. * Update based on PR feedback. * Restore default crosshair formatting, write tests. * Fixing unit tests that failed CI. * Commit unsaved changes.
- Loading branch information
1 parent
9776a52
commit 5f20258
Showing
8 changed files
with
193 additions
and
31 deletions.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
src-docs/src/views/series_chart_histogram/format_crosshair_times.js
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,26 @@ | ||
import React from 'react'; | ||
import { | ||
EuiSeriesChart, | ||
EuiHistogramSeries, | ||
EuiSeriesChartUtils, | ||
} from '../../../../src/experimental'; | ||
|
||
const { SCALE } = EuiSeriesChartUtils; | ||
let timeseriesX = Date.now(); | ||
const HOUR = 1000 * 60 * 60; | ||
|
||
const histogramData = new Array(1000).fill(0).map(() => { | ||
const x0 = timeseriesX; | ||
timeseriesX += HOUR; | ||
const x = timeseriesX; | ||
const y = Math.floor(Math.random() * 100); | ||
return { x0, x, y }; | ||
}); | ||
|
||
export const FormatCrosshairTimesExample = () => ( | ||
<div> | ||
<EuiSeriesChart xCrosshairFormat="YYYY-MM-DD hh:mmZ" height={200} xType={SCALE.TIME}> | ||
<EuiHistogramSeries yDomain={[0, 100]} name="Chart Name" data={histogramData} /> | ||
</EuiSeriesChart> | ||
</div> | ||
); |
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
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