mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Primarily- moving majority of the types and utils from @grafana/ui to @grafana/data * Move types from grafana-ui to grafana-data * Move valueFormats to grafana-data * Move utils from grafana-ui to grafana-data * Update imports in grafana-ui * revert data's tsconfig change * Update imports in grafana-runtime * Fix import paths in grafana-ui * Move rxjs to devDeps * Core import updates batch 1 * Import updates batch 2 * Imports fix batch 3 * Imports fixes batch i don't know * Fix imorts in grafana-toolkit * Fix imports after master merge
40 lines
967 B
TypeScript
40 lines
967 B
TypeScript
// Libraries
|
|
import React, { PureComponent } from 'react';
|
|
|
|
// Services & Utils
|
|
import { config } from 'app/core/config';
|
|
|
|
// Components
|
|
import { PieChart } from '@grafana/ui';
|
|
import { getFieldDisplayValues } from '@grafana/data';
|
|
|
|
// Types
|
|
import { PieChartOptions } from './types';
|
|
import { PanelProps } from '@grafana/data';
|
|
|
|
interface Props extends PanelProps<PieChartOptions> {}
|
|
|
|
export class PieChartPanel extends PureComponent<Props> {
|
|
render() {
|
|
const { width, height, options, data, replaceVariables } = this.props;
|
|
|
|
const values = getFieldDisplayValues({
|
|
fieldOptions: options.fieldOptions,
|
|
data: data.series,
|
|
theme: config.theme,
|
|
replaceVariables: replaceVariables,
|
|
}).map(v => v.display);
|
|
|
|
return (
|
|
<PieChart
|
|
width={width}
|
|
height={height}
|
|
values={values}
|
|
pieType={options.pieType}
|
|
strokeWidth={options.strokeWidth}
|
|
theme={config.theme}
|
|
/>
|
|
);
|
|
}
|
|
}
|