Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
VladLasitsa committed Mar 28, 2022
1 parent 0039dc4 commit c8b86b3
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { HorizontalAlignment, Position, VerticalAlignment } from '@elastic/charts';
import { $Values } from '@kbn/utility-types';
import type { ExpressionValueVisDimension } from '../../../../visualizations/public';
import { Datatable } from '../../../../expressions';
import { PaletteOutput } from '../../../../charts/common';
import { EventAnnotationOutput } from '../../../../event_annotation/common';
Expand Down Expand Up @@ -192,12 +193,8 @@ export type AnnotationLayerConfigResult = AnnotationLayerArgs & {

export interface ReferenceLineLayerArgs {
layerId: string;
<<<<<<< HEAD
accessors: Array<string | ExpressionValueVisDimension>;
=======
accessors: string[];
columnToLabel?: string;
>>>>>>> Kunzetsov/chart_expressions-xy
yConfig?: YConfigResult[];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { layerTypes } from '../../common';
import { Datatable } from '../../../../../src/plugins/expressions/public';
import { getAxesConfiguration } from './axes_configuration';
import { LensDataLayerConfigResult as DataLayerConfigResult } from './types';
import { XYDataLayerConfig } from './types';

describe('axes_configuration', () => {
const tables: Record<string, Datatable> = {
Expand Down Expand Up @@ -219,8 +219,7 @@ describe('axes_configuration', () => {
},
};

const sampleLayer: DataLayerConfigResult = {
type: 'dataLayer',
const sampleLayer: XYDataLayerConfig = {
layerId: 'first',
layerType: layerTypes.DATA,
seriesType: 'line',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import { FramePublicAPI } from '../types';
import { LensDataLayerConfigResult as DataLayerConfigResult } from './types';
import { computeOverallDataDomain, getStaticValue } from './reference_line_helpers';
import { XYDataLayerConfig } from './types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ import { Datatable } from '../../../../../src/plugins/expressions/public';
import type { DatasourcePublicAPI, FramePublicAPI, Visualization } from '../types';
import { groupAxesByType } from './axes_configuration';
import { isHorizontalChart, isPercentageSeries, isStackedChart } from './state_helpers';
import type {
XYState,
XYDataLayerConfig,
XYReferenceLineLayerConfig,
YLensConfig as YConfig,
} from './types';
import type { XYState, XYDataLayerConfig, XYReferenceLineLayerConfig, YConfig } from './types';
import {
checkScaleOperation,
getAxisName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
XYDataLayerConfig,
XYReferenceLineLayerConfig,
ValidLayer,
YLensConfig as YConfig,
YConfig,
} from './types';
import { getDataLayers, isAnnotationsLayer, isDataLayer } from './visualization_helpers';

Expand Down
9 changes: 7 additions & 2 deletions x-pack/plugins/lens/public/xy_visualization/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import type {
LabelsOrientationConfig,
EndValue,
YConfig,
YScaleType,
XScaleType,
} from '../../../../../src/plugins/chart_expressions/expression_xy/common';
import { EventAnnotationConfig } from '../../../../../src/plugins/event_annotation/common';
import type { ValueLabelConfig } from '../../common/types';
Expand All @@ -42,6 +44,10 @@ export interface XYDataLayerConfig {
hide?: boolean;
yConfig?: YConfig[];
splitAccessor?: string;
columnToLabel?: string;
yScaleType?: YScaleType;
xScaleType?: XScaleType;
isHistogram?: boolean;
palette?: PaletteOutput;
}

Expand All @@ -64,11 +70,10 @@ export type XYLayerConfig =
| XYReferenceLineLayerConfig
| XYAnnotationLayerConfig;

export interface ValidLayer extends DataLayerConfigResult {
export interface ValidLayer extends XYDataLayerConfig {
xAccessor: NonNullable<XYDataLayerConfig['xAccessor']>;
splitAccessor?: string;
accessors: string[];
yConfig?: YLensConfigResult[];
}

// Persisted parts of the state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ import {
SeriesType,
YAxisMode,
} from '../../../../../src/plugins/chart_expressions/expression_xy/common';
import { State, visualizationTypes, XYSuggestion, XYLayerConfig, XYDataLayerConfig } from './types';
import {
State,
visualizationTypes,
XYSuggestion,
XYLayerConfig,
XYDataLayerConfig,
YConfig,
} from './types';
import { layerTypes } from '../../common';
import { isHorizontalChart } from './state_helpers';
import { toExpression, toPreviewExpression, getSortedAccessors } from './to_expression';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
import { EuiButtonGroup, EuiFormRow, htmlIdGenerator } from '@elastic/eui';
import type { PaletteRegistry } from 'src/plugins/charts/public';
import type { VisualizationDimensionEditorProps } from '../../types';
import { State, XYState, XYDataLayerConfig, YLensConfig as YConfig } from '../types';
import { State, XYState, XYDataLayerConfig, YConfig } from '../types';
import { FormatFactory } from '../../../common';
import { YAxisMode } from '../../../../../../src/plugins/chart_expressions/expression_xy/common';
import { isHorizontalChart } from '../state_helpers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
import { EuiButtonGroup, EuiFormRow } from '@elastic/eui';
import type { PaletteRegistry } from 'src/plugins/charts/public';
import type { VisualizationDimensionEditorProps } from '../../types';
import { State, XYState, XYReferenceLineLayerConfig, YLensConfig as YConfig } from '../types';
import { State, XYState, XYReferenceLineLayerConfig, YConfig } from '../types';
import { FormatFactory } from '../../../common';
import { FillStyle } from '../../../../../../src/plugins/chart_expressions/expression_xy/common';

Expand Down

0 comments on commit c8b86b3

Please sign in to comment.