Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9dfab8a
Added comments for places I wished to refactor.
Kuznietsov Aug 12, 2021
76b1f5d
Merge branch 'master' into xy_chart
Kuznietsov Aug 23, 2021
8a6b502
Fixed comments.
Kuznietsov Aug 23, 2021
f74fc28
Removed logic, related to BUCKET_TYPES.
Kuznietsov Sep 1, 2021
87fd22f
removed aggType connected code.
Kuznietsov Sep 1, 2021
df2e3db
Added `id` to `xy_dimension` to avoid direct comparison with aggId
Kuznietsov Sep 2, 2021
6093e96
Removed all checks of seriesParams at chart.
Kuznietsov Sep 2, 2021
80eb59f
removed aggId and aggType from chart
Kuznietsov Sep 2, 2021
74867c6
Merge branch 'master' into xy_chart
kibanamachine Sep 2, 2021
807a8eb
removed all aggId/aggTypes from tests/mocks.
Kuznietsov Sep 2, 2021
c803841
Fixed comment.
Kuznietsov Sep 2, 2021
ce5c1d4
moved `get_agg_id.ts` util to the vislib
Kuznietsov Sep 2, 2021
8276a66
clearified the code, related to isSimpleField logic.
Kuznietsov Sep 2, 2021
ef3dcef
added comment.
Kuznietsov Sep 2, 2021
9909715
Fixed error at percentile agg.
Kuznietsov Sep 2, 2021
4b34965
Fixed render_all_series failure of tests.
Kuznietsov Sep 2, 2021
7dd186a
Added tests for new behavior.
Kuznietsov Sep 2, 2021
a325fe4
changed the way of handling `enableHistogramMode`.
Kuznietsov Sep 3, 2021
6a70424
updated snapshots.
Kuznietsov Sep 3, 2021
defbf4f
Merge branch 'master' into xy_chart
Kuznietsov Sep 3, 2021
4fe713e
remove not used lib.
Kuznietsov Sep 3, 2021
bc7f819
Merge branch 'master' into xy_chart_step_2
Kuznietsov Sep 6, 2021
9803617
added XDomain function.
Kuznietsov Sep 6, 2021
86dd481
Added timezone.
Kuznietsov Sep 7, 2021
bfe428b
removed all code, connected to 'interval'
Kuznietsov Sep 7, 2021
5ff3a00
Fixed types at to_ast.ts.
Kuznietsov Sep 7, 2021
f4ea45c
updated tests.
Kuznietsov Sep 7, 2021
38d066c
Fixed types errors.
Kuznietsov Sep 7, 2021
10d17a3
updated code of x_domain.
Kuznietsov Sep 8, 2021
5b0fd1c
Applied enableHistogramMode for single bars.
Kuznietsov Sep 10, 2021
c7f7f9d
Merge branch 'presentation/feature-xy' into xy_chart_step_2
kibanamachine Sep 10, 2021
33dc89f
Merge branch 'presentation/feature-xy' into xy_chart
kibanamachine Sep 10, 2021
aa6e158
Merge branch 'presentation/feature-xy' into xy_chart
kibanamachine Sep 10, 2021
84fe9a9
Merge branch 'presentation/feature-xy' into xy_chart
kibanamachine Sep 10, 2021
bea0dbd
added fix for histogram mode.
Kuznietsov Sep 13, 2021
fa9bc9d
Merge branch 'master' into xy_chart
Kuznietsov Sep 13, 2021
42dba8d
Merge branch 'xy_chart' into xy_chart_step_2
Kuznietsov Sep 13, 2021
566c1d1
Fixed types error at `x_domain`.
Kuznietsov Sep 13, 2021
308a84e
Merge branch 'master' into xy_chart
kibanamachine Sep 13, 2021
7139a71
Removed references to xy types at vislib.
Kuznietsov Sep 13, 2021
e0aca67
Merge branch 'master' into xy_chart
kibanamachine Sep 13, 2021
b4f3f2f
Fixed bug.
Kuznietsov Sep 13, 2021
b897712
Merge branch 'master' into xy_chart_step_2
kibanamachine Sep 14, 2021
6072669
Fixed tests.
Kuznietsov Sep 14, 2021
bbe4077
Merge branch 'master' into xy_chart
kibanamachine Sep 14, 2021
7714247
Fixed shard_delay test.
Kuznietsov Sep 14, 2021
4c283a2
Merge branch 'xy_chart' into xy_chart_step_2
Kuznietsov Sep 14, 2021
218f2dc
Merge remote-tracking branch 'upstream/presentation/feature-xy' into …
Kuznietsov Sep 22, 2021
e615369
fixed duplicated fn.
Kuznietsov Sep 22, 2021
6ab5eca
fixed bugs with split series.
Kuznietsov Sep 22, 2021
bf1197c
Moved `getNextToAccessorColumn` to accessor.ts
Kuznietsov Sep 24, 2021
27457e2
Added tests to accessor.ts.
Kuznietsov Sep 24, 2021
dd9b6d6
added tests for accessors at xy.
Kuznietsov Sep 24, 2021
ca9d514
added tests for getXAccessor.
Kuznietsov Sep 24, 2021
c9e7dcb
added test for force applying formatter.
Kuznietsov Sep 24, 2021
952d78e
added tests for isPercentileIdEqualToSeriesId
Kuznietsov Sep 24, 2021
d8bc348
Merge branch 'presentation/feature-xy' into xy_chart_step_2
kibanamachine Sep 24, 2021
49924ee
Removed not used Accessor type import.
Kuznietsov Sep 24, 2021
2ca1874
Small refactor of code.
Kuznietsov Sep 24, 2021
a61fee6
Merge branch 'presentation/feature-xy' into xy_chart_step_2
kibanamachine Sep 27, 2021
3511c9b
Added description to the x_domain expression.
Kuznietsov Sep 28, 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: 2 additions & 0 deletions src/plugins/data/common/search/aggs/agg_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { IAggType } from './agg_type';
import { writeParams } from './agg_params';
import { IAggConfigs } from './agg_configs';
import { parseTimeShift } from './utils';
import { TimeBuckets } from './buckets/lib/time_buckets';

/** @public **/
export type AggConfigSerialized = Ensure<
Expand Down Expand Up @@ -92,6 +93,7 @@ export class AggConfig {
public parent?: IAggConfigs;
public brandNew?: boolean;
public schema?: string;
public buckets?: TimeBuckets;

private __type: IAggType;
private __typeDecorations: any;
Expand Down
48 changes: 48 additions & 0 deletions src/plugins/vis_types/vislib/public/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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 enum AxisType {
Category = 'category',
Value = 'value',
}

export enum ScaleType {
Linear = 'linear',
Log = 'log',
SquareRoot = 'square root',
}

export enum AxisMode {
Normal = 'normal',
Percentage = 'percentage',
Wiggle = 'wiggle',
Silhouette = 'silhouette',
}

export enum InterpolationMode {
Linear = 'linear',
Cardinal = 'cardinal',
StepAfter = 'step-after',
}

export enum ChartMode {
Normal = 'normal',
Stacked = 'stacked',
}

export enum ChartType {
Line = 'line',
Area = 'area',
Histogram = 'histogram',
}

export enum ThresholdLineStyle {
Full = 'full',
Dashed = 'dashed',
DotDashed = 'dot-dashed',
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { ValueAxis } from '../../../../../xy/public';
import { ValueAxis } from '../../../types';
import {
BasicOptions,
SelectOption,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { FormattedMessage } from '@kbn/i18n/react';

import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { SwitchOption } from '../../../../../../vis_default_editor/public';
import { ValueAxis } from '../../../../../xy/public';
import { ValueAxis } from '../../../types';

import { HeatmapVisParams } from '../../../heatmap';

Expand Down
3 changes: 2 additions & 1 deletion src/plugins/vis_types/vislib/public/heatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { RangeValues } from '../../../vis_default_editor/public';
import { AggGroupNames } from '../../../data/public';
import { ColorSchemas, ColorSchemaParams } from '../../../charts/public';
import { VIS_EVENT_TO_TRIGGER, VisTypeDefinition } from '../../../visualizations/public';
import { ValueAxis, ScaleType, AxisType } from '../../xy/public';
import { ScaleType, AxisType } from './constants';
import { ValueAxis } from './types';

import { HeatmapOptions } from './editor';
import { TimeMarker } from './vislib/visualizations/time_marker';
Expand Down
10 changes: 7 additions & 3 deletions src/plugins/vis_types/vislib/public/to_ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ import {
VisParams,
} from '../../../visualizations/public';
import { buildExpression, buildExpressionFunction } from '../../../expressions/public';
import type { Dimensions } from '../../xy/public';
import type { Dimensions } from './types';
import type { DateHistogramParams, HistogramParams } from '../../../visualizations/public';

import { BUCKET_TYPES } from '../../../data/public';

import { vislibVisName, VisTypeVislibExpressionFunctionDefinition } from './vis_type_vislib_vis_fn';
import { BasicVislibParams, VislibChartType } from './types';
import { getEsaggsFn } from './to_ast_esaggs';
import { getColumnByAccessor } from './vislib/helpers';

export const toExpressionAst = async <TVisParams extends VisParams>(
vis: Vis<TVisParams>,
Expand All @@ -42,7 +43,8 @@ export const toExpressionAst = async <TVisParams extends VisParams>(
const responseAggs = vis.data.aggs?.getResponseAggs() ?? [];

if (dimensions.x) {
const xAgg = responseAggs[dimensions.x.accessor] as any;
const xAgg = getColumnByAccessor(responseAggs, dimensions.x?.accessor) as any;

if (xAgg.type.name === BUCKET_TYPES.DATE_HISTOGRAM) {
(dimensions.x.params as DateHistogramParams).date = true;
const { esUnit, esValue } = xAgg.buckets.getInterval();
Expand All @@ -67,7 +69,9 @@ export const toExpressionAst = async <TVisParams extends VisParams>(
const visConfig = { ...vis.params };

(dimensions.y || []).forEach((yDimension) => {
const yAgg = responseAggs.filter(({ enabled }) => enabled)[yDimension.accessor];
const enabledAggs = responseAggs.filter(({ enabled }) => enabled);
const yAgg = getColumnByAccessor(enabledAggs, yDimension.accessor);

const seriesParam = ((visConfig.seriesParams as BasicVislibParams['seriesParams']) || []).find(
(param) => param.data.id === yAgg.id
);
Expand Down
96 changes: 88 additions & 8 deletions src/plugins/vis_types/vislib/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,82 @@
import { $Values } from '@kbn/utility-types';
import { Position } from '@elastic/charts';

import { Labels } from '../../../charts/public';
import {
CategoryAxis,
Dimensions,
Grid,
SeriesParam,
ThresholdLine,
ValueAxis,
} from '../../../vis_types/xy/public';
DateHistogramParams,
FakeParams,
HistogramParams,
SchemaConfig,
} from '../../../visualizations/public';
import { Labels, Style } from '../../../charts/public';
import { TimeMarker } from './vislib/visualizations/time_marker';
import {
AxisMode,
AxisType,
ChartMode,
ChartType,
InterpolationMode,
ScaleType,
ThresholdLineStyle,
} from './constants';

export interface ThresholdLine {
show: boolean;
value: number | null;
width: number | null;
style: ThresholdLineStyle;
color: string;
}

export interface SeriesParam {
data: { label: string; id: string };
drawLinesBetweenPoints?: boolean;
interpolate?: InterpolationMode;
lineWidth?: number;
mode: ChartMode;
show: boolean;
showCircles: boolean;
circlesRadius: number;
type: ChartType;
valueAxis: string;
}

export interface Grid {
categoryLines: boolean;
valueAxis?: string;
}

export interface Scale {
boundsMargin?: number | '';
defaultYExtents?: boolean;
max?: number | null;
min?: number | null;
mode?: AxisMode;
setYExtents?: boolean;
type: ScaleType;
}

export interface CategoryAxis {
id: string;
labels: Labels;
position: Position;
scale: Scale;
show: boolean;
title: {
text?: string;
};
type: AxisType;
/**
* Used only for heatmap, here for consistent types when used in vis_type_vislib
*
* remove with vis_type_vislib
* https://github.com/elastic/kibana/issues/56143
*/
style?: Partial<Style>;
}

export interface ValueAxis extends CategoryAxis {
name: string;
}

/**
* Gauge title alignment
Expand Down Expand Up @@ -69,3 +135,17 @@ export interface BasicVislibParams extends CommonVislibParams {
times: TimeMarker[];
radiusRatio: number;
}

export type Dimension = Omit<SchemaConfig, 'params'> & {
params: DateHistogramParams | HistogramParams | FakeParams | {};
};

export interface Dimensions {
x: Dimension | null;
y: Dimension[];
z?: Dimension[];
width?: Dimension[];
series?: Dimension[];
splitRow?: Dimension[];
splitColumn?: Dimension[];
}
Loading