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

[XY] Expression chart. #127150

Merged
merged 81 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
9388bba
added xy plugin.
Kuznietsov Mar 8, 2022
8df9659
Merge branch 'main' into chart_expressions-xy
kibanamachine Mar 9, 2022
ab72728
Added expressionXY limits.
Kuznietsov Mar 9, 2022
5747322
Merge branch 'chart_expressions-xy' of github.com:Kunzetsov/kibana in…
Kuznietsov Mar 9, 2022
b4ee9c1
Added xy expression functions to the expression_xy plugin.
Kuznietsov Mar 10, 2022
400845d
Moved xy to a separate plugin.
Kuznietsov Mar 11, 2022
b2090f3
Small refactoring.
Kuznietsov Mar 11, 2022
33a06fa
Fixed types.
Kuznietsov Mar 14, 2022
d94fa4f
Merge branch 'main' into chart_expressions-xy
Kuznietsov Mar 14, 2022
663e093
Fixed import of scss.
Kuznietsov Mar 14, 2022
cbffe77
Fixed imports.
Kuznietsov Mar 14, 2022
389f933
Added required plugins.
Kuznietsov Mar 14, 2022
90aa97a
Fixed import
Kuznietsov Mar 14, 2022
1d3a264
Fixed types.
Kuznietsov Mar 14, 2022
a78d45d
Changed expression names.
Kuznietsov Mar 14, 2022
35cab91
Fixed bugs, caused by the refactoring process.
Kuznietsov Mar 14, 2022
847b3c4
Merge branch 'main' into chart_expressions-xy
kibanamachine Mar 15, 2022
ed7f8ea
Fixed lens snapshots.
Kuznietsov Mar 15, 2022
b6daa5d
Removed new line.
Kuznietsov Mar 15, 2022
bda6524
Merge branch 'chart_expressions-xy' of github.com:Kunzetsov/kibana in…
Kuznietsov Mar 15, 2022
c8d40fe
Fixed xy_chart tests.
Kuznietsov Mar 15, 2022
5fed60c
Added lazy loading for xy chart.
Kuznietsov Mar 15, 2022
dc195b2
Fixed xy chart test.
Kuznietsov Mar 15, 2022
d39681f
Fixed broken chart selectors.
Kuznietsov Mar 16, 2022
b901d68
Fixed dashboard tests.
Kuznietsov Mar 16, 2022
d327dfe
dashboard test fixed.
Kuznietsov Mar 16, 2022
b500961
Fixed heatmap vis.
Kuznietsov Mar 16, 2022
7a25b74
Smokescreen test fixed.
Kuznietsov Mar 16, 2022
0004794
more fixes.
Kuznietsov Mar 16, 2022
fc8c0b3
async dashboard tests fixed.
Kuznietsov Mar 16, 2022
98454ad
Fixed xy smokescreen tests selectors.
Kuznietsov Mar 16, 2022
05cccac
fixed show_underlying_data tests.
Kuznietsov Mar 16, 2022
bcf5201
Updated snapshots.
Kuznietsov Mar 16, 2022
99dc773
updated limits.
Kuznietsov Mar 16, 2022
94a5850
Fixed more selectors
Kuznietsov Mar 16, 2022
bfea6f1
Fixed persistent context test.
Kuznietsov Mar 16, 2022
7cb4db4
Fixed some more test at ml.
Kuznietsov Mar 16, 2022
98e8661
Merge branch 'main' into chart_expressions-xy
Kuznietsov Mar 16, 2022
5ea9cc5
Fixed types and imports
Kuznietsov Mar 16, 2022
4f72658
Fixed handlers.inspectorAdapters.tables.logDatatable
Kuznietsov Mar 16, 2022
ee4ec20
Fixed logDatatable
Kuznietsov Mar 17, 2022
e72005c
Translations fixed.
Kuznietsov Mar 17, 2022
902972d
Fixed "Visualize App ... cleans filters and query" test.
Kuznietsov Mar 17, 2022
05b0f8d
Fixed "lens disable auto-apply tests" test.
Kuznietsov Mar 17, 2022
cae1e75
Updated dashboard tests.
Kuznietsov Mar 17, 2022
00c7e28
Fixed translations.
Kuznietsov Mar 17, 2022
0ad3793
Expression tests fixed.
Kuznietsov Mar 17, 2022
2fbe81f
Cleaned up expression_xy.
Kuznietsov Mar 17, 2022
e9c497f
cleaned up lens xy_visualization.
Kuznietsov Mar 17, 2022
ea299ec
fixed more tests.
Kuznietsov Mar 17, 2022
9ea2cbb
Fix of tsvb.
Kuznietsov Mar 17, 2022
46edc6b
Fixed more tests.
Kuznietsov Mar 17, 2022
672885c
Merge branch 'main' into chart_expressions-xy
Kuznietsov Mar 17, 2022
f109200
Merge branch 'main' into chart_expressions-xy
Kuznietsov Mar 17, 2022
498b34e
Fixed xy chart limits.
Kuznietsov Mar 18, 2022
eeefc8b
Merge branch 'chart_expressions-xy' of github.com:Kunzetsov/kibana in…
Kuznietsov Mar 18, 2022
e00f089
Merge branch 'main' into chart_expressions-xy
Kuznietsov Mar 18, 2022
4996ea6
Fixed new tests.
Kuznietsov Mar 18, 2022
97bb678
Fixed types.
Kuznietsov Mar 18, 2022
f91c8d5
Merge branch 'main' into chart_expressions-xy
kibanamachine Mar 20, 2022
0b6db50
Merge branch 'main' into chart_expressions-xy
kibanamachine Mar 21, 2022
75b2e91
Merge branch 'main' into chart_expressions-xy
Kuznietsov Mar 23, 2022
902dae6
Merge branch 'main' into chart_expressions-xy
Kuznietsov Mar 24, 2022
21e34b4
First try to fix merge conflicts.
Kuznietsov Mar 24, 2022
9cc22c8
Fixed annotatations.
Kuznietsov Mar 25, 2022
a99a223
Fixed types.
Kuznietsov Mar 25, 2022
b553456
Updated snapshots
Kuznietsov Mar 25, 2022
60f5645
Merge branch 'main' into chart_expressions-xy
Kuznietsov Mar 25, 2022
dec0d18
Fixed tests.
Kuznietsov Mar 25, 2022
628ade6
Fixed dependencies.
Kuznietsov Mar 25, 2022
cc63956
Fixed i18n.
Kuznietsov Mar 25, 2022
0e4092d
Moved XY state types to lens.
Kuznietsov Mar 25, 2022
ef30205
Fixed more types.
Kuznietsov Mar 25, 2022
f29bdcf
Merge branch 'main' into chart_expressions-xy
Kuznietsov Mar 28, 2022
8139986
Update src/plugins/chart_expressions/expression_xy/README.md
Kuznietsov Mar 28, 2022
8307b73
[CI] Auto-commit changed files from 'node scripts/build_plugin_list_d…
kibanamachine Mar 28, 2022
500fb78
Removed yConfig from *Layers types
Kuznietsov Mar 28, 2022
839b023
Fixed styles.
Kuznietsov Mar 28, 2022
b61e59a
Fixed types.
Kuznietsov Mar 28, 2022
53a6659
Removed not used utils and styles.
Kuznietsov Mar 28, 2022
490159a
Merge branch 'main' into chart_expressions-xy
Kuznietsov Mar 28, 2022
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
/src/plugins/chart_expressions/expression_heatmap/ @elastic/kibana-vis-editors
/src/plugins/chart_expressions/expression_gauge/ @elastic/kibana-vis-editors
/src/plugins/chart_expressions/expression_partition_vis/ @elastic/kibana-vis-editors
/src/plugins/chart_expressions/expression_xy/ @elastic/kibana-vis-editors
/src/plugins/url_forwarding/ @elastic/kibana-vis-editors
/packages/kbn-tinymath/ @elastic/kibana-vis-editors
/x-pack/test/functional/apps/lens @elastic/kibana-vis-editors
Expand Down
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"expressionMetric": "src/plugins/expression_metric",
"expressionMetricVis": "src/plugins/chart_expressions/expression_metric",
"expressionPartitionVis": "src/plugins/chart_expressions/expression_partition_vis",
"expressionXY": "src/plugins/chart_expressions/expression_xy",
"expressionRepeatImage": "src/plugins/expression_repeat_image",
"expressionRevealImage": "src/plugins/expression_reveal_image",
"expressions": "src/plugins/expressions",
Expand Down
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ for use in their own application.
|Expression Tagcloud plugin adds a tagcloud renderer and function to the expression plugin. The renderer will display the Wordcloud chart.


|{kib-repo}blob/{branch}/src/plugins/chart_expressions/expression_xy/README.md[expressionXY]
|A Kibana plugin


|{kib-repo}blob/{branch}/src/plugins/field_formats/README.md[fieldFormats]
|Index pattern fields formatters

Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,4 @@ pageLoadAssetSize:
sessionView: 77750
cloudSecurityPosture: 19109
visTypeGauge: 24113
expressionXY: 41392
9 changes: 9 additions & 0 deletions src/plugins/chart_expressions/expression_xy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# expressionXY

A Kibana plugin
Kuznietsov marked this conversation as resolved.
Show resolved Hide resolved

---

## Development

See the [kibana contributing guide](https://github.com/elastic/kibana/blob/main/CONTRIBUTING.md) for instructions setting up your development environment.
128 changes: 128 additions & 0 deletions src/plugins/chart_expressions/expression_xy/common/__mocks__/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* 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 { Position } from '@elastic/charts';
import { PaletteOutput } from 'src/plugins/charts/common';
import { Datatable, DatatableRow } from 'src/plugins/expressions';
import { LayerTypes } from '../constants';
import { DataLayerConfigResult, LensMultiTable, XYArgs } from '../types';

export const mockPaletteOutput: PaletteOutput = {
type: 'palette',
name: 'mock',
params: {},
};

export const createSampleDatatableWithRows = (rows: DatatableRow[]): Datatable => ({
type: 'datatable',
columns: [
{
id: 'a',
name: 'a',
meta: { type: 'number', params: { id: 'number', params: { pattern: '0,0.000' } } },
},
{
id: 'b',
name: 'b',
meta: { type: 'number', params: { id: 'number', params: { pattern: '000,0' } } },
},
{
id: 'c',
name: 'c',
meta: {
type: 'date',
field: 'order_date',
sourceParams: { type: 'date-histogram', params: { interval: 'auto' } },
params: { id: 'string' },
},
},
{ id: 'd', name: 'ColD', meta: { type: 'string' } },
],
rows,
});

export const sampleLayer: DataLayerConfigResult = {
type: 'dataLayer',
layerId: 'first',
layerType: LayerTypes.DATA,
seriesType: 'line',
xAccessor: 'c',
accessors: ['a', 'b'],
splitAccessor: 'd',
columnToLabel: '{"a": "Label A", "b": "Label B", "d": "Label D"}',
xScaleType: 'ordinal',
yScaleType: 'linear',
isHistogram: false,
palette: mockPaletteOutput,
};

export const createArgsWithLayers = (layers: DataLayerConfigResult[] = [sampleLayer]): XYArgs => ({
xTitle: '',
yTitle: '',
yRightTitle: '',
legend: {
type: 'legendConfig',
isVisible: false,
position: Position.Top,
},
valueLabels: 'hide',
valuesInLegend: false,
axisTitlesVisibilitySettings: {
type: 'axisTitlesVisibilityConfig',
x: true,
yLeft: true,
yRight: true,
},
tickLabelsVisibilitySettings: {
type: 'tickLabelsConfig',
x: true,
yLeft: false,
yRight: false,
},
labelsOrientation: {
type: 'labelsOrientationConfig',
x: 0,
yLeft: -90,
yRight: -45,
},
gridlinesVisibilitySettings: {
type: 'gridlinesConfig',
x: true,
yLeft: false,
yRight: false,
},
yLeftExtent: {
mode: 'full',
type: 'axisExtentConfig',
},
yRightExtent: {
mode: 'full',
type: 'axisExtentConfig',
},
layers,
});

export function sampleArgs() {
const data: LensMultiTable = {
type: 'lens_multitable',
tables: {
first: createSampleDatatableWithRows([
{ a: 1, b: 2, c: 'I', d: 'Foo' },
{ a: 1, b: 5, c: 'J', d: 'Bar' },
]),
},
dateRange: {
fromDate: new Date('2019-01-02T05:00:00.000Z'),
toDate: new Date('2019-01-03T05:00:00.000Z'),
},
};

const args: XYArgs = createArgsWithLayers();

return { data, args };
}
103 changes: 103 additions & 0 deletions src/plugins/chart_expressions/expression_xy/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* 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 XY_VIS = 'xyVis';
export const Y_CONFIG = 'yConfig';
export const MULTITABLE = 'lens_multitable';
export const DATA_LAYER = 'dataLayer';
export const LEGEND_CONFIG = 'legendConfig';
export const XY_VIS_RENDERER = 'xyVis';
export const GRID_LINES_CONFIG = 'gridlinesConfig';
export const TICK_LABELS_CONFIG = 'tickLabelsConfig';
export const AXIS_EXTENT_CONFIG = 'axisExtentConfig';
export const REFERENCE_LINE_LAYER = 'referenceLineLayer';
export const LABELS_ORIENTATION_CONFIG = 'labelsOrientationConfig';
export const AXIS_TITLES_VISIBILITY_CONFIG = 'axisTitlesVisibilityConfig';

export const LayerTypes = {
DATA: 'data',
REFERENCELINE: 'referenceLine',
} as const;

export const FittingFunctions = {
NONE: 'None',
ZERO: 'Zero',
LINEAR: 'Linear',
CARRY: 'Carry',
LOOKAHEAD: 'Lookahead',
} as const;

export const YAxisModes = {
AUTO: 'auto',
LEFT: 'left',
RIGHT: 'right',
BOTTOM: 'bottom',
} as const;

export const AxisExtentModes = {
FULL: 'full',
CUSTOM: 'custom',
DATA_BOUNDS: 'dataBounds',
} as const;

export const LineStyles = {
SOLID: 'solid',
DASHED: 'dashed',
DOTTED: 'dotted',
} as const;

export const FillStyles = {
NONE: 'none',
ABOVE: 'above',
BELOW: 'below',
} as const;

export const IconPositions = {
AUTO: 'auto',
LEFT: 'left',
RIGHT: 'right',
ABOVE: 'above',
BELOW: 'below',
} as const;

export const SeriesTypes = {
BAR: 'bar',
LINE: 'line',
AREA: 'area',
BAR_STACKED: 'bar_stacked',
AREA_STACKED: 'area_stacked',
BAR_HORIZONTAL: 'bar_horizontal',
BAR_PERCENTAGE_STACKED: 'bar_percentage_stacked',
BAR_HORIZONTAL_STACKED: 'bar_horizontal_stacked',
AREA_PERCENTAGE_STACKED: 'area_percentage_stacked',
BAR_HORIZONTAL_PERCENTAGE_STACKED: 'bar_horizontal_percentage_stacked',
} as const;

export const YScaleTypes = {
TIME: 'time',
LINEAR: 'linear',
LOG: 'log',
SQRT: 'sqrt',
} as const;

export const XScaleTypes = {
TIME: 'time',
LINEAR: 'linear',
ORDINAL: 'ordinal',
} as const;

export const XYCurveTypes = {
LINEAR: 'LINEAR',
CURVE_MONOTONE_X: 'CURVE_MONOTONE_X',
} as const;

export const ValueLabelModes = {
HIDE: 'hide',
INSIDE: 'inside',
OUTSIDE: 'outside',
} as const;
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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 { i18n } from '@kbn/i18n';
import type { ExpressionFunctionDefinition } from '../../../../expressions/common';
import { AxisExtentConfig, AxisExtentConfigResult } from '../types';
import { AxisExtentModes, AXIS_EXTENT_CONFIG } from '../constants';

export const axisExtentConfigFunction: ExpressionFunctionDefinition<
typeof AXIS_EXTENT_CONFIG,
null,
AxisExtentConfig,
AxisExtentConfigResult
> = {
name: AXIS_EXTENT_CONFIG,
aliases: [],
type: AXIS_EXTENT_CONFIG,
help: i18n.translate('expressionXY.axisExtentConfig.help', {
defaultMessage: `Configure the xy chart's axis extents`,
}),
inputTypes: ['null'],
args: {
mode: {
types: ['string'],
options: [...Object.values(AxisExtentModes)],
help: i18n.translate('expressionXY.axisExtentConfig.extentMode.help', {
defaultMessage: 'The extent mode',
}),
},
lowerBound: {
types: ['number'],
help: i18n.translate('expressionXY.axisExtentConfig.lowerBound.help', {
defaultMessage: 'Lower bound',
}),
},
upperBound: {
types: ['number'],
help: i18n.translate('expressionXY.axisExtentConfig.upperBound.help', {
defaultMessage: 'Upper bound',
}),
},
},
fn(input, args) {
return {
type: AXIS_EXTENT_CONFIG,
...args,
};
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* 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 { i18n } from '@kbn/i18n';
import type { ExpressionFunctionDefinition } from '../../../../expressions/common';
import { AXIS_TITLES_VISIBILITY_CONFIG } from '../constants';
import { AxesSettingsConfig, AxisTitlesVisibilityConfigResult } from '../types';

export const axisTitlesVisibilityConfigFunction: ExpressionFunctionDefinition<
typeof AXIS_TITLES_VISIBILITY_CONFIG,
null,
AxesSettingsConfig,
AxisTitlesVisibilityConfigResult
> = {
name: AXIS_TITLES_VISIBILITY_CONFIG,
aliases: [],
type: AXIS_TITLES_VISIBILITY_CONFIG,
help: i18n.translate('expressionXY.axisTitlesVisibilityConfig.help', {
defaultMessage: `Configure the xy chart's axis titles appearance`,
}),
inputTypes: ['null'],
args: {
x: {
types: ['boolean'],
help: i18n.translate('expressionXY.axisTitlesVisibilityConfig.x.help', {
defaultMessage: 'Specifies whether or not the title of the x-axis are visible.',
}),
},
yLeft: {
types: ['boolean'],
help: i18n.translate('expressionXY.axisTitlesVisibilityConfig.yLeft.help', {
defaultMessage: 'Specifies whether or not the title of the left y-axis are visible.',
}),
},
yRight: {
types: ['boolean'],
help: i18n.translate('expressionXY.axisTitlesVisibilityConfig.yRight.help', {
defaultMessage: 'Specifies whether or not the title of the right y-axis are visible.',
}),
},
},
fn(inputn, args) {
return {
type: AXIS_TITLES_VISIBILITY_CONFIG,
...args,
};
},
};
Loading