2019-09-17 20:57:53 +02:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-02-04 03:12:39 +01:00
|
|
|
* 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.
|
2019-09-17 20:57:53 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
import { Position } from '@elastic/charts';
|
|
|
|
import { i18n } from '@kbn/i18n';
|
2020-11-04 11:27:52 +01:00
|
|
|
import { PaletteOutput } from 'src/plugins/charts/public';
|
2020-02-11 19:47:36 +01:00
|
|
|
import { ArgumentType, ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
|
2020-09-15 11:24:02 +02:00
|
|
|
import { LensIconChartArea } from '../assets/chart_area';
|
|
|
|
import { LensIconChartAreaStacked } from '../assets/chart_area_stacked';
|
|
|
|
import { LensIconChartAreaPercentage } from '../assets/chart_area_percentage';
|
|
|
|
import { LensIconChartBar } from '../assets/chart_bar';
|
|
|
|
import { LensIconChartBarStacked } from '../assets/chart_bar_stacked';
|
|
|
|
import { LensIconChartBarPercentage } from '../assets/chart_bar_percentage';
|
|
|
|
import { LensIconChartBarHorizontal } from '../assets/chart_bar_horizontal';
|
|
|
|
import { LensIconChartBarHorizontalStacked } from '../assets/chart_bar_horizontal_stacked';
|
|
|
|
import { LensIconChartBarHorizontalPercentage } from '../assets/chart_bar_horizontal_percentage';
|
|
|
|
import { LensIconChartLine } from '../assets/chart_line';
|
2019-10-03 19:30:33 +02:00
|
|
|
|
2021-01-12 10:45:53 +01:00
|
|
|
import { VisualizationType } from '../types';
|
2020-07-03 16:15:06 +02:00
|
|
|
import { FittingFunction } from './fitting_functions';
|
2019-09-17 20:57:53 +02:00
|
|
|
|
|
|
|
export interface LegendConfig {
|
2020-07-22 12:14:59 +02:00
|
|
|
/**
|
|
|
|
* Flag whether the legend should be shown. If there is just a single series, it will be hidden
|
|
|
|
*/
|
2019-09-17 20:57:53 +02:00
|
|
|
isVisible: boolean;
|
2020-07-22 12:14:59 +02:00
|
|
|
/**
|
|
|
|
* Position of the legend relative to the chart
|
|
|
|
*/
|
2019-09-17 20:57:53 +02:00
|
|
|
position: Position;
|
2020-07-22 12:14:59 +02:00
|
|
|
/**
|
|
|
|
* Flag whether the legend should be shown even with just a single series
|
|
|
|
*/
|
|
|
|
showSingleSeries?: boolean;
|
2019-09-17 20:57:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type LegendConfigResult = LegendConfig & { type: 'lens_xy_legendConfig' };
|
|
|
|
|
2020-02-11 19:47:36 +01:00
|
|
|
export const legendConfig: ExpressionFunctionDefinition<
|
2019-09-17 20:57:53 +02:00
|
|
|
'lens_xy_legendConfig',
|
|
|
|
null,
|
|
|
|
LegendConfig,
|
|
|
|
LegendConfigResult
|
|
|
|
> = {
|
|
|
|
name: 'lens_xy_legendConfig',
|
|
|
|
aliases: [],
|
|
|
|
type: 'lens_xy_legendConfig',
|
|
|
|
help: `Configure the xy chart's legend`,
|
2020-02-11 19:47:36 +01:00
|
|
|
inputTypes: ['null'],
|
2019-09-17 20:57:53 +02:00
|
|
|
args: {
|
|
|
|
isVisible: {
|
|
|
|
types: ['boolean'],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.isVisible.help', {
|
|
|
|
defaultMessage: 'Specifies whether or not the legend is visible.',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
position: {
|
|
|
|
types: ['string'],
|
|
|
|
options: [Position.Top, Position.Right, Position.Bottom, Position.Left],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.position.help', {
|
|
|
|
defaultMessage: 'Specifies the legend position.',
|
|
|
|
}),
|
|
|
|
},
|
2020-07-22 12:14:59 +02:00
|
|
|
showSingleSeries: {
|
|
|
|
types: ['boolean'],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.showSingleSeries.help', {
|
|
|
|
defaultMessage: 'Specifies whether a legend with just a single entry should be shown',
|
|
|
|
}),
|
|
|
|
},
|
2019-09-17 20:57:53 +02:00
|
|
|
},
|
2020-02-11 19:47:36 +01:00
|
|
|
fn: function fn(input: unknown, args: LegendConfig) {
|
2019-09-17 20:57:53 +02:00
|
|
|
return {
|
|
|
|
type: 'lens_xy_legendConfig',
|
|
|
|
...args,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-08-11 19:10:35 +02:00
|
|
|
export interface AxesSettingsConfig {
|
|
|
|
x: boolean;
|
2020-09-16 10:30:19 +02:00
|
|
|
yLeft: boolean;
|
|
|
|
yRight: boolean;
|
2020-08-11 19:10:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type TickLabelsConfigResult = AxesSettingsConfig & { type: 'lens_xy_tickLabelsConfig' };
|
|
|
|
|
|
|
|
export const tickLabelsConfig: ExpressionFunctionDefinition<
|
|
|
|
'lens_xy_tickLabelsConfig',
|
|
|
|
null,
|
|
|
|
AxesSettingsConfig,
|
|
|
|
TickLabelsConfigResult
|
|
|
|
> = {
|
|
|
|
name: 'lens_xy_tickLabelsConfig',
|
|
|
|
aliases: [],
|
|
|
|
type: 'lens_xy_tickLabelsConfig',
|
|
|
|
help: `Configure the xy chart's tick labels appearance`,
|
|
|
|
inputTypes: ['null'],
|
|
|
|
args: {
|
|
|
|
x: {
|
|
|
|
types: ['boolean'],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.xAxisTickLabels.help', {
|
|
|
|
defaultMessage: 'Specifies whether or not the tick labels of the x-axis are visible.',
|
|
|
|
}),
|
|
|
|
},
|
2020-09-16 10:30:19 +02:00
|
|
|
yLeft: {
|
2020-08-11 19:10:35 +02:00
|
|
|
types: ['boolean'],
|
2020-09-16 10:30:19 +02:00
|
|
|
help: i18n.translate('xpack.lens.xyChart.yLeftAxisTickLabels.help', {
|
|
|
|
defaultMessage: 'Specifies whether or not the tick labels of the left y-axis are visible.',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
yRight: {
|
|
|
|
types: ['boolean'],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.yRightAxisTickLabels.help', {
|
|
|
|
defaultMessage: 'Specifies whether or not the tick labels of the right y-axis are visible.',
|
2020-08-11 19:10:35 +02:00
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
fn: function fn(input: unknown, args: AxesSettingsConfig) {
|
|
|
|
return {
|
|
|
|
type: 'lens_xy_tickLabelsConfig',
|
|
|
|
...args,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
type GridlinesConfigResult = AxesSettingsConfig & { type: 'lens_xy_gridlinesConfig' };
|
|
|
|
|
|
|
|
export const gridlinesConfig: ExpressionFunctionDefinition<
|
|
|
|
'lens_xy_gridlinesConfig',
|
|
|
|
null,
|
|
|
|
AxesSettingsConfig,
|
|
|
|
GridlinesConfigResult
|
|
|
|
> = {
|
|
|
|
name: 'lens_xy_gridlinesConfig',
|
|
|
|
aliases: [],
|
|
|
|
type: 'lens_xy_gridlinesConfig',
|
|
|
|
help: `Configure the xy chart's gridlines appearance`,
|
|
|
|
inputTypes: ['null'],
|
|
|
|
args: {
|
|
|
|
x: {
|
|
|
|
types: ['boolean'],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.xAxisGridlines.help', {
|
|
|
|
defaultMessage: 'Specifies whether or not the gridlines of the x-axis are visible.',
|
|
|
|
}),
|
|
|
|
},
|
2020-09-16 10:30:19 +02:00
|
|
|
yLeft: {
|
|
|
|
types: ['boolean'],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.yLeftAxisgridlines.help', {
|
|
|
|
defaultMessage: 'Specifies whether or not the gridlines of the left y-axis are visible.',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
yRight: {
|
2020-08-11 19:10:35 +02:00
|
|
|
types: ['boolean'],
|
2020-09-16 10:30:19 +02:00
|
|
|
help: i18n.translate('xpack.lens.xyChart.yRightAxisgridlines.help', {
|
|
|
|
defaultMessage: 'Specifies whether or not the gridlines of the right y-axis are visible.',
|
2020-08-11 19:10:35 +02:00
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
fn: function fn(input: unknown, args: AxesSettingsConfig) {
|
|
|
|
return {
|
|
|
|
type: 'lens_xy_gridlinesConfig',
|
|
|
|
...args,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-09-16 10:30:19 +02:00
|
|
|
type AxisTitlesVisibilityConfigResult = AxesSettingsConfig & {
|
|
|
|
type: 'lens_xy_axisTitlesVisibilityConfig';
|
|
|
|
};
|
|
|
|
|
|
|
|
export const axisTitlesVisibilityConfig: ExpressionFunctionDefinition<
|
|
|
|
'lens_xy_axisTitlesVisibilityConfig',
|
|
|
|
null,
|
|
|
|
AxesSettingsConfig,
|
|
|
|
AxisTitlesVisibilityConfigResult
|
|
|
|
> = {
|
|
|
|
name: 'lens_xy_axisTitlesVisibilityConfig',
|
|
|
|
aliases: [],
|
|
|
|
type: 'lens_xy_axisTitlesVisibilityConfig',
|
|
|
|
help: `Configure the xy chart's axis titles appearance`,
|
|
|
|
inputTypes: ['null'],
|
|
|
|
args: {
|
|
|
|
x: {
|
|
|
|
types: ['boolean'],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.xAxisTitle.help', {
|
|
|
|
defaultMessage: 'Specifies whether or not the title of the x-axis are visible.',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
yLeft: {
|
|
|
|
types: ['boolean'],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.yLeftAxisTitle.help', {
|
|
|
|
defaultMessage: 'Specifies whether or not the title of the left y-axis are visible.',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
yRight: {
|
|
|
|
types: ['boolean'],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.yRightAxisTitle.help', {
|
|
|
|
defaultMessage: 'Specifies whether or not the title of the right y-axis are visible.',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
fn: function fn(input: unknown, args: AxesSettingsConfig) {
|
|
|
|
return {
|
|
|
|
type: 'lens_xy_axisTitlesVisibilityConfig',
|
|
|
|
...args,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-09-17 20:57:53 +02:00
|
|
|
interface AxisConfig {
|
|
|
|
title: string;
|
|
|
|
hide?: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
const axisConfig: { [key in keyof AxisConfig]: ArgumentType<AxisConfig[key]> } = {
|
|
|
|
title: {
|
|
|
|
types: ['string'],
|
|
|
|
help: i18n.translate('xpack.lens.xyChart.title.help', {
|
|
|
|
defaultMessage: 'The axis title',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
hide: {
|
|
|
|
types: ['boolean'],
|
|
|
|
default: false,
|
|
|
|
help: 'Show / hide axis',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-07-01 09:57:23 +02:00
|
|
|
type YConfigResult = YConfig & { type: 'lens_xy_yConfig' };
|
2019-09-17 20:57:53 +02:00
|
|
|
|
2020-07-01 09:57:23 +02:00
|
|
|
export const yAxisConfig: ExpressionFunctionDefinition<
|
|
|
|
'lens_xy_yConfig',
|
2020-02-11 19:47:36 +01:00
|
|
|
null,
|
2020-07-01 09:57:23 +02:00
|
|
|
YConfig,
|
|
|
|
YConfigResult
|
2020-02-11 19:47:36 +01:00
|
|
|
> = {
|
2020-07-01 09:57:23 +02:00
|
|
|
name: 'lens_xy_yConfig',
|
2019-09-17 20:57:53 +02:00
|
|
|
aliases: [],
|
2020-07-01 09:57:23 +02:00
|
|
|
type: 'lens_xy_yConfig',
|
|
|
|
help: `Configure the behavior of a xy chart's y axis metric`,
|
2020-02-11 19:47:36 +01:00
|
|
|
inputTypes: ['null'],
|
2019-09-17 20:57:53 +02:00
|
|
|
args: {
|
2020-07-01 09:57:23 +02:00
|
|
|
forAccessor: {
|
2019-09-17 20:57:53 +02:00
|
|
|
types: ['string'],
|
2020-07-01 09:57:23 +02:00
|
|
|
help: 'The accessor this configuration is for',
|
|
|
|
},
|
|
|
|
axisMode: {
|
|
|
|
types: ['string'],
|
|
|
|
options: ['auto', 'left', 'right'],
|
|
|
|
help: 'The axis mode of the metric',
|
2019-09-17 20:57:53 +02:00
|
|
|
},
|
2020-07-03 13:22:47 +02:00
|
|
|
color: {
|
|
|
|
types: ['string'],
|
|
|
|
help: 'The color of the series',
|
|
|
|
},
|
2019-09-17 20:57:53 +02:00
|
|
|
},
|
2020-07-01 09:57:23 +02:00
|
|
|
fn: function fn(input: unknown, args: YConfig) {
|
2019-09-17 20:57:53 +02:00
|
|
|
return {
|
2020-07-01 09:57:23 +02:00
|
|
|
type: 'lens_xy_yConfig',
|
2019-09-17 20:57:53 +02:00
|
|
|
...args,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
type LayerConfigResult = LayerArgs & { type: 'lens_xy_layer' };
|
|
|
|
|
2020-02-11 19:47:36 +01:00
|
|
|
export const layerConfig: ExpressionFunctionDefinition<
|
2019-09-17 20:57:53 +02:00
|
|
|
'lens_xy_layer',
|
|
|
|
null,
|
|
|
|
LayerArgs,
|
|
|
|
LayerConfigResult
|
|
|
|
> = {
|
|
|
|
name: 'lens_xy_layer',
|
|
|
|
aliases: [],
|
|
|
|
type: 'lens_xy_layer',
|
|
|
|
help: `Configure a layer in the xy chart`,
|
2020-02-11 19:47:36 +01:00
|
|
|
inputTypes: ['null'],
|
2019-09-17 20:57:53 +02:00
|
|
|
args: {
|
|
|
|
...axisConfig,
|
|
|
|
layerId: {
|
|
|
|
types: ['string'],
|
|
|
|
help: '',
|
|
|
|
},
|
|
|
|
xAccessor: {
|
|
|
|
types: ['string'],
|
|
|
|
help: '',
|
|
|
|
},
|
|
|
|
seriesType: {
|
|
|
|
types: ['string'],
|
2020-09-15 11:24:02 +02:00
|
|
|
options: [
|
|
|
|
'bar',
|
|
|
|
'line',
|
|
|
|
'area',
|
|
|
|
'bar_stacked',
|
|
|
|
'area_stacked',
|
|
|
|
'bar_percentage_stacked',
|
|
|
|
'area_percentage_stacked',
|
|
|
|
],
|
2019-09-17 20:57:53 +02:00
|
|
|
help: 'The type of chart to display.',
|
|
|
|
},
|
|
|
|
xScaleType: {
|
|
|
|
options: ['ordinal', 'linear', 'time'],
|
|
|
|
help: 'The scale type of the x axis',
|
|
|
|
default: 'ordinal',
|
|
|
|
},
|
|
|
|
isHistogram: {
|
|
|
|
types: ['boolean'],
|
|
|
|
default: false,
|
|
|
|
help: 'Whether to layout the chart as a histogram',
|
|
|
|
},
|
|
|
|
yScaleType: {
|
|
|
|
options: ['log', 'sqrt', 'linear', 'time'],
|
|
|
|
help: 'The scale type of the y axes',
|
|
|
|
default: 'linear',
|
|
|
|
},
|
|
|
|
splitAccessor: {
|
|
|
|
types: ['string'],
|
|
|
|
help: 'The column to split by',
|
|
|
|
multi: false,
|
|
|
|
},
|
|
|
|
accessors: {
|
|
|
|
types: ['string'],
|
|
|
|
help: 'The columns to display on the y axis.',
|
|
|
|
multi: true,
|
|
|
|
},
|
2020-07-01 09:57:23 +02:00
|
|
|
yConfig: {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
types: ['lens_xy_yConfig' as any],
|
|
|
|
help: 'Additional configuration for y axes',
|
|
|
|
multi: true,
|
|
|
|
},
|
2019-09-17 20:57:53 +02:00
|
|
|
columnToLabel: {
|
|
|
|
types: ['string'],
|
|
|
|
help: 'JSON key-value pairs of column ID to label',
|
|
|
|
},
|
2020-11-04 11:27:52 +01:00
|
|
|
palette: {
|
|
|
|
default: `{theme "palette" default={system_palette name="default"} }`,
|
|
|
|
help: '',
|
|
|
|
types: ['palette'],
|
|
|
|
},
|
2019-09-17 20:57:53 +02:00
|
|
|
},
|
2020-02-11 19:47:36 +01:00
|
|
|
fn: function fn(input: unknown, args: LayerArgs) {
|
2019-09-17 20:57:53 +02:00
|
|
|
return {
|
|
|
|
type: 'lens_xy_layer',
|
|
|
|
...args,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-10-02 19:21:39 +02:00
|
|
|
export type SeriesType =
|
|
|
|
| 'bar'
|
|
|
|
| 'bar_horizontal'
|
|
|
|
| 'line'
|
|
|
|
| 'area'
|
|
|
|
| 'bar_stacked'
|
2020-09-15 11:24:02 +02:00
|
|
|
| 'bar_percentage_stacked'
|
2019-10-02 19:21:39 +02:00
|
|
|
| 'bar_horizontal_stacked'
|
2020-09-15 11:24:02 +02:00
|
|
|
| 'bar_horizontal_percentage_stacked'
|
|
|
|
| 'area_stacked'
|
|
|
|
| 'area_percentage_stacked';
|
2019-09-17 20:57:53 +02:00
|
|
|
|
2020-07-01 09:57:23 +02:00
|
|
|
export type YAxisMode = 'auto' | 'left' | 'right';
|
|
|
|
|
2020-11-06 16:34:30 +01:00
|
|
|
export type ValueLabelConfig = 'hide' | 'inside' | 'outside';
|
|
|
|
|
2020-07-01 09:57:23 +02:00
|
|
|
export interface YConfig {
|
|
|
|
forAccessor: string;
|
|
|
|
axisMode?: YAxisMode;
|
2020-07-03 13:22:47 +02:00
|
|
|
color?: string;
|
2020-07-01 09:57:23 +02:00
|
|
|
}
|
|
|
|
|
2021-02-03 12:03:55 +01:00
|
|
|
export interface XYLayerConfig {
|
2019-09-17 20:57:53 +02:00
|
|
|
hide?: boolean;
|
|
|
|
layerId: string;
|
2020-03-17 14:57:52 +01:00
|
|
|
xAccessor?: string;
|
2019-09-17 20:57:53 +02:00
|
|
|
accessors: string[];
|
2020-07-01 09:57:23 +02:00
|
|
|
yConfig?: YConfig[];
|
2019-09-17 20:57:53 +02:00
|
|
|
seriesType: SeriesType;
|
2020-03-17 14:57:52 +01:00
|
|
|
splitAccessor?: string;
|
2020-11-04 11:27:52 +01:00
|
|
|
palette?: PaletteOutput;
|
2019-09-17 20:57:53 +02:00
|
|
|
}
|
|
|
|
|
2021-02-03 12:03:55 +01:00
|
|
|
export interface ValidLayer extends XYLayerConfig {
|
|
|
|
xAccessor: NonNullable<XYLayerConfig['xAccessor']>;
|
2020-11-06 16:34:30 +01:00
|
|
|
}
|
|
|
|
|
2021-02-03 12:03:55 +01:00
|
|
|
export type LayerArgs = XYLayerConfig & {
|
2019-09-17 20:57:53 +02:00
|
|
|
columnToLabel?: string; // Actually a JSON key-value pair
|
|
|
|
yScaleType: 'time' | 'linear' | 'log' | 'sqrt';
|
|
|
|
xScaleType: 'time' | 'linear' | 'ordinal';
|
|
|
|
isHistogram: boolean;
|
2020-11-04 11:27:52 +01:00
|
|
|
// palette will always be set on the expression
|
|
|
|
palette: PaletteOutput;
|
2019-09-17 20:57:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// Arguments to XY chart expression, with computed properties
|
|
|
|
export interface XYArgs {
|
2020-10-01 18:02:37 +02:00
|
|
|
title?: string;
|
|
|
|
description?: string;
|
2019-09-17 20:57:53 +02:00
|
|
|
xTitle: string;
|
|
|
|
yTitle: string;
|
2020-09-16 10:30:19 +02:00
|
|
|
yRightTitle: string;
|
2020-02-11 19:47:36 +01:00
|
|
|
legend: LegendConfig & { type: 'lens_xy_legendConfig' };
|
2020-11-06 16:34:30 +01:00
|
|
|
valueLabels: ValueLabelConfig;
|
2019-09-17 20:57:53 +02:00
|
|
|
layers: LayerArgs[];
|
2020-07-03 16:15:06 +02:00
|
|
|
fittingFunction?: FittingFunction;
|
2020-09-16 10:30:19 +02:00
|
|
|
axisTitlesVisibilitySettings?: AxesSettingsConfig & {
|
|
|
|
type: 'lens_xy_axisTitlesVisibilityConfig';
|
|
|
|
};
|
2020-08-11 19:10:35 +02:00
|
|
|
tickLabelsVisibilitySettings?: AxesSettingsConfig & { type: 'lens_xy_tickLabelsConfig' };
|
|
|
|
gridlinesVisibilitySettings?: AxesSettingsConfig & { type: 'lens_xy_gridlinesConfig' };
|
2019-09-17 20:57:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Persisted parts of the state
|
|
|
|
export interface XYState {
|
|
|
|
preferredSeriesType: SeriesType;
|
|
|
|
legend: LegendConfig;
|
2020-11-06 16:34:30 +01:00
|
|
|
valueLabels?: ValueLabelConfig;
|
2020-07-03 16:15:06 +02:00
|
|
|
fittingFunction?: FittingFunction;
|
2021-02-03 12:03:55 +01:00
|
|
|
layers: XYLayerConfig[];
|
2020-08-11 19:10:35 +02:00
|
|
|
xTitle?: string;
|
|
|
|
yTitle?: string;
|
2020-09-16 10:30:19 +02:00
|
|
|
yRightTitle?: string;
|
|
|
|
axisTitlesVisibilitySettings?: AxesSettingsConfig;
|
2020-08-11 19:10:35 +02:00
|
|
|
tickLabelsVisibilitySettings?: AxesSettingsConfig;
|
|
|
|
gridlinesVisibilitySettings?: AxesSettingsConfig;
|
2019-09-17 20:57:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export type State = XYState;
|
|
|
|
|
|
|
|
export const visualizationTypes: VisualizationType[] = [
|
|
|
|
{
|
|
|
|
id: 'bar',
|
2020-09-15 11:24:02 +02:00
|
|
|
icon: LensIconChartBar,
|
2019-09-17 20:57:53 +02:00
|
|
|
label: i18n.translate('xpack.lens.xyVisualization.barLabel', {
|
|
|
|
defaultMessage: 'Bar',
|
|
|
|
}),
|
|
|
|
},
|
2019-10-02 19:21:39 +02:00
|
|
|
{
|
|
|
|
id: 'bar_horizontal',
|
2020-09-15 11:24:02 +02:00
|
|
|
icon: LensIconChartBarHorizontal,
|
2019-10-02 19:21:39 +02:00
|
|
|
label: i18n.translate('xpack.lens.xyVisualization.barHorizontalLabel', {
|
2020-10-06 17:17:41 +02:00
|
|
|
defaultMessage: 'H. Bar',
|
|
|
|
}),
|
|
|
|
fullLabel: i18n.translate('xpack.lens.xyVisualization.barHorizontalFullLabel', {
|
2019-10-25 18:09:41 +02:00
|
|
|
defaultMessage: 'Horizontal bar',
|
2019-10-02 19:21:39 +02:00
|
|
|
}),
|
|
|
|
},
|
2019-09-17 20:57:53 +02:00
|
|
|
{
|
|
|
|
id: 'bar_stacked',
|
2020-09-15 11:24:02 +02:00
|
|
|
icon: LensIconChartBarStacked,
|
2019-10-03 19:30:33 +02:00
|
|
|
label: i18n.translate('xpack.lens.xyVisualization.stackedBarLabel', {
|
2019-10-25 18:09:41 +02:00
|
|
|
defaultMessage: 'Stacked bar',
|
2019-09-17 20:57:53 +02:00
|
|
|
}),
|
|
|
|
},
|
2020-09-15 11:24:02 +02:00
|
|
|
{
|
|
|
|
id: 'bar_percentage_stacked',
|
|
|
|
icon: LensIconChartBarPercentage,
|
|
|
|
label: i18n.translate('xpack.lens.xyVisualization.stackedPercentageBarLabel', {
|
2020-10-06 17:17:41 +02:00
|
|
|
defaultMessage: 'Percentage bar',
|
2020-09-15 11:24:02 +02:00
|
|
|
}),
|
|
|
|
},
|
2019-10-02 19:21:39 +02:00
|
|
|
{
|
|
|
|
id: 'bar_horizontal_stacked',
|
2020-09-15 11:24:02 +02:00
|
|
|
icon: LensIconChartBarHorizontalStacked,
|
2019-10-02 19:21:39 +02:00
|
|
|
label: i18n.translate('xpack.lens.xyVisualization.stackedBarHorizontalLabel', {
|
2020-10-06 17:17:41 +02:00
|
|
|
defaultMessage: 'H. Stacked bar',
|
|
|
|
}),
|
|
|
|
fullLabel: i18n.translate('xpack.lens.xyVisualization.stackedBarHorizontalFullLabel', {
|
|
|
|
defaultMessage: 'Horizontal stacked bar',
|
2019-10-02 19:21:39 +02:00
|
|
|
}),
|
|
|
|
},
|
2019-09-17 20:57:53 +02:00
|
|
|
{
|
2020-09-15 11:24:02 +02:00
|
|
|
id: 'bar_horizontal_percentage_stacked',
|
|
|
|
icon: LensIconChartBarHorizontalPercentage,
|
|
|
|
label: i18n.translate('xpack.lens.xyVisualization.stackedPercentageBarHorizontalLabel', {
|
2020-10-06 17:17:41 +02:00
|
|
|
defaultMessage: 'H. Percentage bar',
|
2019-09-17 20:57:53 +02:00
|
|
|
}),
|
2020-10-06 17:17:41 +02:00
|
|
|
fullLabel: i18n.translate(
|
|
|
|
'xpack.lens.xyVisualization.stackedPercentageBarHorizontalFullLabel',
|
|
|
|
{
|
|
|
|
defaultMessage: 'Horizontal percentage bar',
|
|
|
|
}
|
|
|
|
),
|
2019-09-17 20:57:53 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'area',
|
2020-09-15 11:24:02 +02:00
|
|
|
icon: LensIconChartArea,
|
2019-09-17 20:57:53 +02:00
|
|
|
label: i18n.translate('xpack.lens.xyVisualization.areaLabel', {
|
|
|
|
defaultMessage: 'Area',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'area_stacked',
|
2020-09-15 11:24:02 +02:00
|
|
|
icon: LensIconChartAreaStacked,
|
2019-09-17 20:57:53 +02:00
|
|
|
label: i18n.translate('xpack.lens.xyVisualization.stackedAreaLabel', {
|
2019-10-25 18:09:41 +02:00
|
|
|
defaultMessage: 'Stacked area',
|
2019-09-17 20:57:53 +02:00
|
|
|
}),
|
|
|
|
},
|
2020-09-15 11:24:02 +02:00
|
|
|
{
|
|
|
|
id: 'area_percentage_stacked',
|
|
|
|
icon: LensIconChartAreaPercentage,
|
|
|
|
label: i18n.translate('xpack.lens.xyVisualization.stackedPercentageAreaLabel', {
|
2020-10-06 17:17:41 +02:00
|
|
|
defaultMessage: 'Percentage area',
|
2020-09-15 11:24:02 +02:00
|
|
|
}),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'line',
|
|
|
|
icon: LensIconChartLine,
|
|
|
|
label: i18n.translate('xpack.lens.xyVisualization.lineLabel', {
|
|
|
|
defaultMessage: 'Line',
|
|
|
|
}),
|
|
|
|
},
|
2019-09-17 20:57:53 +02:00
|
|
|
];
|