-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace flot with elastic-chart in Timelion #81565
Merged
Merged
Changes from 74 commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
ff810c8
First draft migrate timelion to elastic-charts
VladLasitsa 6d7f157
Some refactoring. Added brush event.
VladLasitsa b888e79
Merge remote-tracking branch 'origin/#79984' into #79984
VladLasitsa 999c2d7
Added title. Some refactoring
VladLasitsa f43a965
Fixed some type problems. Added logic for yaxes function
VladLasitsa af60792
Fixed some types, added missing functionality for yaxes
VladLasitsa f429afe
Fixed some types, added missing functionality for stack property
VladLasitsa c94a3fc
Merge branch 'master' into #79984
kibanamachine 5cd3a48
Fixed unit test
VladLasitsa 4b3a294
Removed unneeded code
VladLasitsa 1e7eee7
Some refactoring
VladLasitsa 901f8c7
Some refactoring
VladLasitsa 5942f9b
Merge branch 'master' into #79984
kibanamachine 60c1e11
Fixed some remarks.
VladLasitsa 4f8c59a
Fixed some styles
VladLasitsa 9be84d7
Added themes. Removed unneeded styles in BarSeries
VladLasitsa 6711dac
removed unneeded code.
VladLasitsa 6d74017
Fixed some comments
VladLasitsa 039d3b4
Merge remote-tracking branch 'upstream/master' into #79984
VladLasitsa de41259
Fixed vertical cursor across Timelion visualizations of a dashboad
VladLasitsa 63a12db
Fix some problems with styles
VladLasitsa 2726c0c
Merge remote-tracking branch 'upstream/master' into #79984
VladLasitsa 07181ae
Merge remote-tracking branch 'upstream/master' into #79984
VladLasitsa ca9aeac
Use RxJS instead of jQuery
VladLasitsa 13033c5
Remove unneeded code
VladLasitsa 703e3f3
Merge remote-tracking branch 'upstream/master' into #79984
VladLasitsa 18d9c37
Fixed some problems
VladLasitsa 53b1c08
Fixed unit test
VladLasitsa 6c8b842
Merge branch 'master' into #79984
kibanamachine c2ba661
Merge branch 'master' into #79984
VladLasitsa aac4b77
Fix CI
VladLasitsa 75fb061
Merge branch 'master' into #79984
kibanamachine 24a188a
Fix eslint
VladLasitsa 7ad545f
Merge branch 'master' into #79984
kibanamachine d369fc4
Fix some gaps
VladLasitsa 035516a
Merge branch 'master' into #79984
kibanamachine 15b6ec7
Fix legend columns
VladLasitsa b079e0d
Merge branch 'master' into #79984
kibanamachine 9944016
Some fixes
VladLasitsa 010617c
add 2 versions of Timeline app
alexwizp bc63434
fix CI
alexwizp 81add31
cleanup code
alexwizp 0bc12e1
fix CI
alexwizp 6f33935
fix legend position
alexwizp 56c0760
fix some cases
alexwizp f52fd07
fix some cases
alexwizp cd2cb7e
remove extra casting
alexwizp e4c3b96
cleanup code
alexwizp 451054c
fix issue with static
alexwizp 1898b8d
fix header formatter
alexwizp a1edcf5
fix points
alexwizp 641ffab
Merge remote-tracking branch 'upstream/master' into #79984
alexwizp d330823
fix ts error
alexwizp f087902
Fix yaxis behavior
VladLasitsa e4397bb
Merge branch 'master' into #79984
kibanamachine 9af9dcb
Fix some case with yaxis
VladLasitsa 0ca56a1
Merge remote-tracking branch 'upstream/master' into #79984
alexwizp a84fa78
Merge branch 'master' into #79984
kibanamachine 7ca06e1
Merge branch 'master' into #79984
kibanamachine 022b8a5
Merge branch 'master' into #79984
kibanamachine 0eb286f
Add deprecation message and update asciidoc
VladLasitsa 574d045
Merge branch 'master' into #79984
kibanamachine 572df6e
Fix title
VladLasitsa b027add
Merge branch 'master' into #79984
kibanamachine edab9a6
Merge branch 'master' into #79984
kibanamachine 5082a31
Merge branch 'master' into #79984
kibanamachine 8dd67ff
Merge branch 'master' into #79984
kibanamachine 33c9b70
Merge branch 'master' into #79984
kibanamachine 4d5292b
Merge branch 'master' into #79984
kibanamachine eac6a41
Merge branch 'master' into #79984
kibanamachine 757e95a
Merge branch 'master' into #79984
kibanamachine 56a94b4
Merge branch 'master' into #79984
kibanamachine c95ef4b
Merge remote-tracking branch 'upstream/master' into #79984
VladLasitsa bf63108
some text improvements
VladLasitsa acb6bce
Merge branch 'master' into #79984
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,18 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export const UI_SETTINGS = { | ||
LEGACY_CHARTS_LIBRARY: 'timelion:legacyChartsLibrary', | ||
ES_TIMEFIELD: 'timelion:es.timefield', | ||
DEFAULT_INDEX: 'timelion:es.default_index', | ||
TARGET_BUCKETS: 'timelion:target_buckets', | ||
MAX_BUCKETS: 'timelion:max_buckets', | ||
MIN_INTERVAL: 'timelion:min_interval', | ||
GRAPHITE_URL: 'timelion:graphite.url', | ||
QUANDL_KEY: 'timelion:quandl.key', | ||
}; |
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,33 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export interface VisSeries { | ||
yaxis?: number; | ||
label: string; | ||
lines?: { | ||
show?: boolean; | ||
lineWidth?: number; | ||
fill?: number; | ||
steps?: number; | ||
}; | ||
points?: { | ||
show?: boolean; | ||
symbol?: 'cross' | 'x' | 'circle' | 'square' | 'diamond' | 'plus' | 'triangle'; | ||
fillColor?: string; | ||
fill?: number; | ||
radius?: number; | ||
lineWidth?: number; | ||
}; | ||
bars: { | ||
lineWidth?: number; | ||
fill?: number; | ||
}; | ||
color?: string; | ||
data: Array<Array<number | null>>; | ||
stack: boolean; | ||
} |
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
62 changes: 62 additions & 0 deletions
62
src/plugins/vis_type_timelion/public/components/series/area.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,62 @@ | ||
/* | ||
* 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, ScaleType, CurveType, AreaSeriesStyle, PointShape } from '@elastic/charts'; | ||
import type { VisSeries } from '../../../common/vis_data'; | ||
|
||
interface AreaSeriesComponentProps { | ||
index: number; | ||
visData: VisSeries; | ||
groupId: string; | ||
} | ||
|
||
const isShowLines = (lines: VisSeries['lines'], points: VisSeries['points']) => | ||
lines?.show ? true : points?.show ? false : true; | ||
|
||
const getAreaSeriesStyle = ({ color, lines, points }: AreaSeriesComponentProps['visData']) => | ||
({ | ||
line: { | ||
opacity: isShowLines(lines, points) ? 1 : 0, | ||
stroke: color, | ||
strokeWidth: lines?.lineWidth !== undefined ? Number(lines.lineWidth) : 3, | ||
visible: isShowLines(lines, points), | ||
}, | ||
area: { | ||
fill: color, | ||
opacity: lines?.fill ?? 0, | ||
visible: lines?.show ?? points?.show ?? true, | ||
}, | ||
point: { | ||
fill: points?.fillColor ?? color, | ||
opacity: points?.lineWidth !== undefined ? (points.fill || 1) * 10 : 10, | ||
radius: points?.radius ?? 3, | ||
stroke: color, | ||
strokeWidth: points?.lineWidth ?? 2, | ||
visible: points?.show ?? false, | ||
shape: points?.symbol === 'cross' ? PointShape.X : points?.symbol, | ||
}, | ||
curve: lines?.steps ? CurveType.CURVE_STEP : CurveType.LINEAR, | ||
} as AreaSeriesStyle); | ||
|
||
export const AreaSeriesComponent = ({ index, groupId, visData }: AreaSeriesComponentProps) => ( | ||
<AreaSeries | ||
id={index + visData.label} | ||
groupId={groupId} | ||
name={visData.label} | ||
xScaleType={ScaleType.Time} | ||
yScaleType={ScaleType.Linear} | ||
xAccessor={0} | ||
yAccessors={[1]} | ||
data={visData.data} | ||
sortIndex={index} | ||
color={visData.color} | ||
stackAccessors={visData.stack ? [0] : undefined} | ||
areaSeriesStyle={getAreaSeriesStyle(visData)} | ||
/> | ||
); |
58 changes: 58 additions & 0 deletions
58
src/plugins/vis_type_timelion/public/components/series/bar.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,58 @@ | ||
/* | ||
* 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 { BarSeries, ScaleType, BarSeriesStyle } from '@elastic/charts'; | ||
import type { VisSeries } from '../../../common/vis_data'; | ||
|
||
interface BarSeriesComponentProps { | ||
index: number; | ||
visData: VisSeries; | ||
groupId: string; | ||
} | ||
|
||
const getBarSeriesStyle = ({ color, bars }: BarSeriesComponentProps['visData']) => { | ||
let opacity = bars.fill ?? 1; | ||
|
||
if (opacity < 0) { | ||
opacity = 0; | ||
} else if (opacity > 1) { | ||
opacity = 1; | ||
} | ||
|
||
return { | ||
rectBorder: { | ||
stroke: color, | ||
strokeWidth: Math.max(1, bars.lineWidth ? Math.ceil(bars.lineWidth / 2) : 1), | ||
visible: true, | ||
}, | ||
rect: { | ||
fill: color, | ||
opacity, | ||
widthPixel: 1, | ||
}, | ||
} as BarSeriesStyle; | ||
}; | ||
|
||
export const BarSeriesComponent = ({ index, groupId, visData }: BarSeriesComponentProps) => ( | ||
<BarSeries | ||
id={index + visData.label} | ||
groupId={groupId} | ||
name={visData.label} | ||
xScaleType={ScaleType.Time} | ||
yScaleType={ScaleType.Linear} | ||
xAccessor={0} | ||
yAccessors={[1]} | ||
data={visData.data} | ||
sortIndex={index} | ||
enableHistogramMode={false} | ||
color={visData.color} | ||
stackAccessors={visData.stack ? [0] : undefined} | ||
barSeriesStyle={getBarSeriesStyle(visData)} | ||
/> | ||
); |
10 changes: 10 additions & 0 deletions
10
src/plugins/vis_type_timelion/public/components/series/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,10 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { BarSeriesComponent } from './bar'; | ||
export { AreaSeriesComponent } from './area'; |
56 changes: 3 additions & 53 deletions
56
src/plugins/vis_type_timelion/public/components/timelion_vis.scss
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 |
---|---|---|
@@ -1,60 +1,10 @@ | ||
.timChart { | ||
.timelionChart { | ||
height: 100%; | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
// Custom Jquery FLOT / schema selectors | ||
// Cannot change at the moment | ||
|
||
.chart-top-title { | ||
@include euiFontSizeXS; | ||
flex: 0; | ||
text-align: center; | ||
font-weight: $euiFontWeightBold; | ||
} | ||
|
||
.chart-canvas { | ||
min-width: 100%; | ||
flex: 1; | ||
overflow: hidden; | ||
} | ||
|
||
.legendLabel { | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
overflow-x: hidden; | ||
line-height: normal; | ||
} | ||
|
||
.legendColorBox { | ||
vertical-align: middle; | ||
} | ||
|
||
.ngLegendValue { | ||
color: $euiTextColor; | ||
cursor: pointer; | ||
|
||
&:focus, | ||
&:hover { | ||
text-decoration: underline; | ||
} | ||
} | ||
|
||
.ngLegendValueNumber { | ||
margin-left: $euiSizeXS; | ||
margin-right: $euiSizeXS; | ||
font-weight: $euiFontWeightBold; | ||
} | ||
|
||
.flot-tick-label { | ||
font-size: $euiFontSizeXS; | ||
color: $euiColorDarkShade; | ||
} | ||
} | ||
|
||
.timChart__legendCaption { | ||
color: $euiTextColor; | ||
white-space: nowrap; | ||
font-weight: $euiFontWeightBold; | ||
.timelionChart__topTitle { | ||
VladLasitsa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
text-align: center; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
showLines