PieChartPanel.tsx 811 B

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