-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
132 additions
and
37 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
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
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/aiops/public/components/mini_histogram/index.ts
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,8 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { MiniHistogram } from './mini_histogram'; |
71 changes: 71 additions & 0 deletions
71
x-pack/plugins/aiops/public/components/mini_histogram/mini_histogram.tsx
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,71 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React, { FC } from 'react'; | ||
|
||
import { Chart, BarSeries, PartialTheme, ScaleType, Settings } from '@elastic/charts'; | ||
|
||
import type { ChangePointHistogramItem } from '@kbn/ml-agg-utils'; | ||
|
||
interface MiniHistogramProps { | ||
chartData: ChangePointHistogramItem[]; | ||
label: string; | ||
} | ||
|
||
export const MiniHistogram: FC<MiniHistogramProps> = ({ chartData, label }) => { | ||
const theme: PartialTheme = { | ||
chartMargins: { | ||
left: 0, | ||
right: 0, | ||
top: 0, | ||
bottom: 0, | ||
}, | ||
chartPaddings: { | ||
left: 0, | ||
right: 0, | ||
top: 0, | ||
bottom: 0, | ||
}, | ||
scales: { | ||
barsPadding: 0.1, | ||
}, | ||
}; | ||
|
||
return ( | ||
<div | ||
style={{ | ||
width: '80px', | ||
height: '24px', | ||
margin: '0px', | ||
}} | ||
> | ||
<Chart> | ||
<Settings theme={theme} showLegend={false} /> | ||
<BarSeries | ||
id="Other" | ||
xScaleType={ScaleType.Time} | ||
yScaleType={ScaleType.Linear} | ||
xAccessor={'key'} | ||
yAccessors={['doc_count_overall']} | ||
data={chartData} | ||
stackAccessors={[0]} | ||
// color={['lightblue']} | ||
/> | ||
<BarSeries | ||
id={`${label}`} | ||
xScaleType={ScaleType.Time} | ||
yScaleType={ScaleType.Linear} | ||
xAccessor={'key'} | ||
yAccessors={['doc_count_change_point']} | ||
data={chartData} | ||
stackAccessors={[0]} | ||
color={['orange']} | ||
/> | ||
</Chart> | ||
</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