PieChartPanel.tsx 1015 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Libraries
  2. import React, { PureComponent } from 'react';
  3. // Services & Utils
  4. import { config } from 'app/core/config';
  5. // Components
  6. import { PieChart, getSingleStatDisplayValues } from '@grafana/ui';
  7. // Types
  8. import { PieChartOptions } from './types';
  9. import { PanelProps } from '@grafana/ui/src/types';
  10. interface Props extends PanelProps<PieChartOptions> {}
  11. export class PieChartPanel extends PureComponent<Props> {
  12. render() {
  13. const { width, height, options, data, replaceVariables } = this.props;
  14. const values = getSingleStatDisplayValues({
  15. valueMappings: options.valueMappings,
  16. thresholds: options.thresholds,
  17. valueOptions: options.valueOptions,
  18. data: data.series,
  19. theme: config.theme,
  20. replaceVariables: replaceVariables,
  21. });
  22. return (
  23. <PieChart
  24. width={width}
  25. height={height}
  26. values={values}
  27. pieType={options.pieType}
  28. strokeWidth={options.strokeWidth}
  29. theme={config.theme}
  30. />
  31. );
  32. }
  33. }