Add datalinks support to PieChart v2 (#31642)

* Remove default value for multiSelect

* Add data links support for PieChart v2

* Temporarily fix story

* Refactor PieSlice, deduplicate colors

* Add field config to context menu of pie chart

* Add custom key to legend

This is a bit hacky. When there are multiple DisplayValues with the same
title the react keys collide and LegendListItems are not cleared
correctly.

* Forgot to add the interface

* Fix missing tooltip in edit mode
This commit is contained in:
Oscar Kilhed
2021-03-10 23:02:04 +01:00
committed by GitHub
parent 477a54ae54
commit e7757b0175
7 changed files with 135 additions and 73 deletions

View File

@@ -23,20 +23,20 @@ export const PieChartPanel: React.FC<Props> = ({
[fieldConfig, onFieldConfigChange]
);
const values = getFieldDisplayValues({
const fieldDisplayValues = getFieldDisplayValues({
fieldConfig,
reduceOptions: options.reduceOptions,
data: data.series,
theme: useTheme(),
replaceVariables: replaceVariables,
timeZone,
}).map((v) => v.display);
});
return (
<PieChart
width={width}
height={height}
values={values}
fieldDisplayValues={fieldDisplayValues}
onSeriesColorChange={onSeriesColorChange}
pieType={options.pieType}
displayLabels={options.displayLabels}