GraphPanelEditor.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //// Libraries
  2. import _ from 'lodash';
  3. import React, { PureComponent } from 'react';
  4. // Types
  5. import { PanelEditorProps, Switch } from '@grafana/ui';
  6. import { Options } from './types';
  7. export class GraphPanelEditor extends PureComponent<PanelEditorProps<Options>> {
  8. onToggleLines = () => {
  9. this.props.onChange({ ...this.props.options, showLines: !this.props.options.showLines });
  10. };
  11. onToggleBars = () => {
  12. this.props.onChange({ ...this.props.options, showBars: !this.props.options.showBars });
  13. };
  14. onTogglePoints = () => {
  15. this.props.onChange({ ...this.props.options, showPoints: !this.props.options.showPoints });
  16. };
  17. render() {
  18. const { showBars, showPoints, showLines } = this.props.options;
  19. return (
  20. <div>
  21. <div className="section gf-form-group">
  22. <h5 className="section-heading">Draw Modes</h5>
  23. <Switch label="Lines" labelClass="width-5" checked={showLines} onChange={this.onToggleLines} />
  24. <Switch label="Bars" labelClass="width-5" checked={showBars} onChange={this.onToggleBars} />
  25. <Switch label="Points" labelClass="width-5" checked={showPoints} onChange={this.onTogglePoints} />
  26. </div>
  27. <div className="section gf-form-group">
  28. <h5 className="section-heading">Test Options</h5>
  29. <Switch label="Lines" labelClass="width-5" checked={showLines} onChange={this.onToggleLines} />
  30. <Switch label="Bars" labelClass="width-5" checked={showBars} onChange={this.onToggleBars} />
  31. <Switch label="Points" labelClass="width-5" checked={showPoints} onChange={this.onTogglePoints} />
  32. </div>
  33. </div>
  34. );
  35. }
  36. }