Skip to content
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 75 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from 13 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 Oct 23, 2020
6d7f157
Some refactoring. Added brush event.
VladLasitsa Oct 23, 2020
b888e79
Merge remote-tracking branch 'origin/#79984' into #79984
VladLasitsa Oct 26, 2020
999c2d7
Added title. Some refactoring
VladLasitsa Oct 27, 2020
f43a965
Fixed some type problems. Added logic for yaxes function
VladLasitsa Oct 29, 2020
af60792
Fixed some types, added missing functionality for yaxes
VladLasitsa Oct 30, 2020
f429afe
Fixed some types, added missing functionality for stack property
VladLasitsa Nov 2, 2020
c94a3fc
Merge branch 'master' into #79984
kibanamachine Nov 3, 2020
5cd3a48
Fixed unit test
VladLasitsa Nov 3, 2020
4b3a294
Removed unneeded code
VladLasitsa Nov 3, 2020
1e7eee7
Some refactoring
VladLasitsa Nov 4, 2020
901f8c7
Some refactoring
VladLasitsa Nov 5, 2020
5942f9b
Merge branch 'master' into #79984
kibanamachine Nov 6, 2020
60c1e11
Fixed some remarks.
VladLasitsa Nov 6, 2020
4f8c59a
Fixed some styles
VladLasitsa Nov 6, 2020
9be84d7
Added themes. Removed unneeded styles in BarSeries
VladLasitsa Nov 9, 2020
6711dac
removed unneeded code.
VladLasitsa Nov 12, 2020
6d74017
Fixed some comments
VladLasitsa Nov 16, 2020
039d3b4
Merge remote-tracking branch 'upstream/master' into #79984
VladLasitsa Nov 16, 2020
de41259
Fixed vertical cursor across Timelion visualizations of a dashboad
VladLasitsa Nov 16, 2020
63a12db
Fix some problems with styles
VladLasitsa Nov 17, 2020
2726c0c
Merge remote-tracking branch 'upstream/master' into #79984
VladLasitsa Nov 17, 2020
07181ae
Merge remote-tracking branch 'upstream/master' into #79984
VladLasitsa Nov 19, 2020
ca9aeac
Use RxJS instead of jQuery
VladLasitsa Nov 19, 2020
13033c5
Remove unneeded code
VladLasitsa Nov 24, 2020
703e3f3
Merge remote-tracking branch 'upstream/master' into #79984
VladLasitsa Nov 24, 2020
18d9c37
Fixed some problems
VladLasitsa Nov 25, 2020
53b1c08
Fixed unit test
VladLasitsa Nov 26, 2020
6c8b842
Merge branch 'master' into #79984
kibanamachine Jan 29, 2021
c2ba661
Merge branch 'master' into #79984
VladLasitsa Feb 1, 2021
aac4b77
Fix CI
VladLasitsa Feb 1, 2021
75fb061
Merge branch 'master' into #79984
kibanamachine Feb 4, 2021
24a188a
Fix eslint
VladLasitsa Feb 4, 2021
7ad545f
Merge branch 'master' into #79984
kibanamachine May 12, 2021
d369fc4
Fix some gaps
VladLasitsa May 12, 2021
035516a
Merge branch 'master' into #79984
kibanamachine May 31, 2021
15b6ec7
Fix legend columns
VladLasitsa May 31, 2021
b079e0d
Merge branch 'master' into #79984
kibanamachine Jun 7, 2021
9944016
Some fixes
VladLasitsa Jun 8, 2021
010617c
add 2 versions of Timeline app
alexwizp Jun 9, 2021
bc63434
fix CI
alexwizp Jun 9, 2021
81add31
cleanup code
alexwizp Jun 9, 2021
0bc12e1
fix CI
alexwizp Jun 11, 2021
6f33935
fix legend position
alexwizp Jun 11, 2021
56c0760
fix some cases
alexwizp Jun 11, 2021
f52fd07
fix some cases
alexwizp Jun 14, 2021
cd2cb7e
remove extra casting
alexwizp Jun 14, 2021
e4c3b96
cleanup code
alexwizp Jun 15, 2021
451054c
fix issue with static
alexwizp Jun 15, 2021
1898b8d
fix header formatter
alexwizp Jun 15, 2021
a1edcf5
fix points
alexwizp Jun 15, 2021
641ffab
Merge remote-tracking branch 'upstream/master' into #79984
alexwizp Jun 15, 2021
d330823
fix ts error
alexwizp Jun 16, 2021
f087902
Fix yaxis behavior
VladLasitsa Jun 16, 2021
e4397bb
Merge branch 'master' into #79984
kibanamachine Jun 16, 2021
9af9dcb
Fix some case with yaxis
VladLasitsa Jun 16, 2021
0ca56a1
Merge remote-tracking branch 'upstream/master' into #79984
alexwizp Jun 18, 2021
a84fa78
Merge branch 'master' into #79984
kibanamachine Jun 21, 2021
7ca06e1
Merge branch 'master' into #79984
kibanamachine Jun 21, 2021
022b8a5
Merge branch 'master' into #79984
kibanamachine Jun 22, 2021
0eb286f
Add deprecation message and update asciidoc
VladLasitsa Jun 22, 2021
574d045
Merge branch 'master' into #79984
kibanamachine Jun 24, 2021
572df6e
Fix title
VladLasitsa Jun 28, 2021
b027add
Merge branch 'master' into #79984
kibanamachine Jun 28, 2021
edab9a6
Merge branch 'master' into #79984
kibanamachine Jun 30, 2021
5082a31
Merge branch 'master' into #79984
kibanamachine Jul 1, 2021
8dd67ff
Merge branch 'master' into #79984
kibanamachine Jul 5, 2021
33c9b70
Merge branch 'master' into #79984
kibanamachine Jul 6, 2021
4d5292b
Merge branch 'master' into #79984
kibanamachine Jul 13, 2021
eac6a41
Merge branch 'master' into #79984
kibanamachine Jul 14, 2021
757e95a
Merge branch 'master' into #79984
kibanamachine Jul 20, 2021
56a94b4
Merge branch 'master' into #79984
kibanamachine Jul 27, 2021
c95ef4b
Merge remote-tracking branch 'upstream/master' into #79984
VladLasitsa Jul 29, 2021
bf63108
some text improvements
VladLasitsa Jul 29, 2021
acb6bce
Merge branch 'master' into #79984
kibanamachine Aug 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugins/timelion/public/panels/timechart/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export function timechartFn(dependencies: TimelionVisualizationDependencies) {
help: 'Draw a timeseries chart',
render($scope: any, $elem: any) {
const template = '<div class="chart-top-title"></div><div class="chart-canvas"></div>';
const formatters = tickFormatters() as any;
const getxAxisFormatter = xaxisFormatterProvider(uiSettings);
const generateTicks = generateTicksProvider();

Expand Down Expand Up @@ -360,6 +359,7 @@ export function timechartFn(dependencies: TimelionVisualizationDependencies) {
if (options.yaxes) {
options.yaxes.forEach((yaxis: any) => {
if (yaxis && yaxis.units) {
const formatters = tickFormatters(yaxis) as any;
yaxis.tickFormatter = formatters[yaxis.units.type];
const byteModes = ['bytes', 'bytes/s'];
if (byteModes.includes(yaxis.units.type)) {
Expand Down
63 changes: 11 additions & 52 deletions src/plugins/vis_type_timelion/public/components/_timelion_vis.scss
Original file line number Diff line number Diff line change
@@ -1,61 +1,20 @@
.timChart {
.timChart__legendCaption {
color: $euiTextColor;
white-space: nowrap;
font-weight: $euiFontWeightBold;
}

.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;
.chart-top-title {
VladLasitsa marked this conversation as resolved.
Show resolved Hide resolved
@include euiFontSizeXS;
flex: 0;
text-align: center;
font-weight: $euiFontWeightBold;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React from 'react';
import { AreaSeries, ScaleType, CurveType } from '@elastic/charts';

export function AreaSeriesComponent({ data, index }: { data: any; index: number }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question, do we know, what shape of data is comming at this prop and can we describe it by providing types?

const lines = data.lines || {};
const points = data.points || {};
const styles = {
areaSeriesStyle: {
line: {
stroke: data.color,
strokeWidth: Number(lines.lineWidth) || 3,
VladLasitsa marked this conversation as resolved.
Show resolved Hide resolved
visible: lines.show ?? true,
},
area: {
fill: data.color,
opacity: !lines.fill || lines.fill < 0 ? 0 : lines.fill,
visible: lines.show ?? true,
},
point: {
fill: points.fillColor,
opacity: !points.fill || points.fill < 0 ? 1 : points.fill,
VladLasitsa marked this conversation as resolved.
Show resolved Hide resolved
radius: points.radius || 3,
VladLasitsa marked this conversation as resolved.
Show resolved Hide resolved
stroke: data.color,
strokeWidth: points.lineWidth || 2,
VladLasitsa marked this conversation as resolved.
Show resolved Hide resolved
visible: Boolean(points.show),
VladLasitsa marked this conversation as resolved.
Show resolved Hide resolved
},
},
curve: lines.steps ? CurveType.CURVE_STEP : CurveType.LINEAR,
};

return (
<AreaSeries
id={index + data.label}
name={data.label}
xScaleType={ScaleType.Time}
yScaleType={ScaleType.Linear}
xAccessor={0}
yAccessors={[1]}
data={data.data}
sortIndex={index}
color={data.color}
stackAccessors={data.stack ? [0] : undefined}
stratoula marked this conversation as resolved.
Show resolved Hide resolved
{...styles}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React from 'react';
import { BarSeries, ScaleType } from '@elastic/charts';

export function BarSeriesComponent({ data, index }: { data: any; index: number }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same question, as before.

const bars = data.bars || {};
const styles = {
barSeriesStyle: {
rectBorder: {
stroke: data.color,
strokeWidth: parseInt(bars.lineWidth || '0', 10),
visible: bars.show ?? true,
},
rect: {
fill: data.color,
opacity: !bars.fill || bars.fill < 0 ? 1 : bars.fill,
VladLasitsa marked this conversation as resolved.
Show resolved Hide resolved
},
},
};

return (
<BarSeries
id={index + data.label}
name={data.label}
xScaleType={ScaleType.Time}
yScaleType={ScaleType.Linear}
xAccessor={0}
yAccessors={[1]}
data={data.data}
sortIndex={index}
color={data.color}
stackAccessors={data.stack ? [0] : undefined}
{...styles}
/>
);
}
Loading