Commit dd4eab17 by Torkel Ödegaard

panel options wip

parent 0df14f3f
...@@ -12,6 +12,10 @@ import { PanelProps, NullValueMode } from 'app/types'; ...@@ -12,6 +12,10 @@ import { PanelProps, NullValueMode } from 'app/types';
interface Options { interface Options {
showBars: boolean; showBars: boolean;
showLines: boolean;
showPoints: boolean;
onChange: (options: Options) => void;
} }
interface Props extends PanelProps { interface Props extends PanelProps {
...@@ -35,14 +39,27 @@ export class Graph2 extends PureComponent<Props> { ...@@ -35,14 +39,27 @@ export class Graph2 extends PureComponent<Props> {
} }
} }
export class TextOptions extends PureComponent<any> { export class TextOptions extends PureComponent<Options> {
onChange = () => {}; onToggleLines = () => {
const options = this.props as Options;
this.props.onChange({
...options,
showLines: !this.props.showLines,
});
};
render() { render() {
const { showBars, showPoints, showLines } = this.props;
return ( return (
<div className="section gf-form-group"> <div>
<h5 className="section-heading">Draw Modes</h5> <div className="section gf-form-group">
<Switch label="Lines" checked={true} onChange={this.onChange} /> <h5 className="page-heading">Draw Modes</h5>
<Switch label="Lines" labelClass="width-5" checked={showLines} onChange={this.onToggleLines} />
<Switch label="Bars" labelClass="width-5" checked={showBars} onChange={this.onToggleLines} />
<Switch label="Points" labelClass="width-5" checked={showPoints} onChange={this.onToggleLines} />
</div>
</div> </div>
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment