2020-05-05 21:59:32 +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.
|
2020-05-05 21:59:32 +02:00
|
|
|
*/
|
|
|
|
|
2020-11-04 11:27:52 +01:00
|
|
|
import { PaletteOutput } from 'src/plugins/charts/public';
|
2020-05-05 21:59:32 +02:00
|
|
|
import { LensMultiTable } from '../types';
|
|
|
|
|
2021-02-03 12:03:55 +01:00
|
|
|
export interface SharedPieLayerState {
|
2020-05-05 21:59:32 +02:00
|
|
|
groups: string[];
|
|
|
|
metric?: string;
|
|
|
|
numberDisplay: 'hidden' | 'percent' | 'value';
|
|
|
|
categoryDisplay: 'default' | 'inside' | 'hide';
|
|
|
|
legendDisplay: 'default' | 'show' | 'hide';
|
2020-07-22 12:14:59 +02:00
|
|
|
legendPosition?: 'left' | 'right' | 'top' | 'bottom';
|
2020-05-05 21:59:32 +02:00
|
|
|
nestedLegend?: boolean;
|
|
|
|
percentDecimals?: number;
|
|
|
|
}
|
|
|
|
|
2021-02-03 12:03:55 +01:00
|
|
|
export type PieLayerState = SharedPieLayerState & {
|
2020-05-05 21:59:32 +02:00
|
|
|
layerId: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export interface PieVisualizationState {
|
|
|
|
shape: 'donut' | 'pie' | 'treemap';
|
2021-02-03 12:03:55 +01:00
|
|
|
layers: PieLayerState[];
|
2020-11-04 11:27:52 +01:00
|
|
|
palette?: PaletteOutput;
|
2020-05-05 21:59:32 +02:00
|
|
|
}
|
|
|
|
|
2021-02-03 12:03:55 +01:00
|
|
|
export type PieExpressionArgs = SharedPieLayerState & {
|
2020-10-01 18:02:37 +02:00
|
|
|
title?: string;
|
|
|
|
description?: string;
|
2020-05-05 21:59:32 +02:00
|
|
|
shape: 'pie' | 'donut' | 'treemap';
|
|
|
|
hideLabels: boolean;
|
2020-11-04 11:27:52 +01:00
|
|
|
palette: PaletteOutput;
|
2020-05-05 21:59:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export interface PieExpressionProps {
|
|
|
|
data: LensMultiTable;
|
|
|
|
args: PieExpressionArgs;
|
|
|
|
}
|