mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
parent
9ded648bc5
commit
e0064ed38e
@ -10,7 +10,7 @@ export interface Options {
|
|||||||
decimals: number;
|
decimals: number;
|
||||||
prefix: string;
|
prefix: string;
|
||||||
stat: string;
|
stat: string;
|
||||||
sufix: string;
|
suffix: string;
|
||||||
unit: string;
|
unit: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,10 +56,10 @@ class GaugeOptions extends PureComponent<PanelOptionsProps<Options>> {
|
|||||||
|
|
||||||
onPrefixChange = event => this.props.onChange({ ...this.props.options, prefix: event.target.value });
|
onPrefixChange = event => this.props.onChange({ ...this.props.options, prefix: event.target.value });
|
||||||
|
|
||||||
onSufixChange = event => this.props.onChange({ ...this.props.options, sufix: event.target.value });
|
onSuffixChange = event => this.props.onChange({ ...this.props.options, suffix: event.target.value });
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { stat, unit, decimals, prefix, sufix } = this.props.options;
|
const { stat, unit, decimals, prefix, suffix } = this.props.options;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="section gf-form-group">
|
<div className="section gf-form-group">
|
||||||
@ -94,8 +94,8 @@ class GaugeOptions extends PureComponent<PanelOptionsProps<Options>> {
|
|||||||
<input className="gf-form-input width-12" type="text" value={prefix || ''} onChange={this.onPrefixChange} />
|
<input className="gf-form-input width-12" type="text" value={prefix || ''} onChange={this.onPrefixChange} />
|
||||||
</div>
|
</div>
|
||||||
<div className="gf-form-inline">
|
<div className="gf-form-inline">
|
||||||
<Label width={5}>Sufix</Label>
|
<Label width={5}>Suffix</Label>
|
||||||
<input className="gf-form-input width-12" type="text" value={sufix || ''} onChange={this.onSufixChange} />
|
<input className="gf-form-input width-12" type="text" value={suffix || ''} onChange={this.onSuffixChange} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,7 +17,7 @@ interface Props {
|
|||||||
height: number;
|
height: number;
|
||||||
stat?: string;
|
stat?: string;
|
||||||
prefix: string;
|
prefix: string;
|
||||||
sufix: string;
|
suffix: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const colors = ['rgba(50, 172, 45, 0.97)', 'rgba(237, 129, 40, 0.89)', 'rgba(245, 54, 54, 0.9)'];
|
const colors = ['rgba(50, 172, 45, 0.97)', 'rgba(237, 129, 40, 0.89)', 'rgba(245, 54, 54, 0.9)'];
|
||||||
@ -32,7 +32,7 @@ export class Gauge extends PureComponent<Props> {
|
|||||||
prefix: '',
|
prefix: '',
|
||||||
showThresholdMarkers: true,
|
showThresholdMarkers: true,
|
||||||
showThresholdLables: false,
|
showThresholdLables: false,
|
||||||
sufix: '',
|
suffix: '',
|
||||||
thresholds: [0, 100],
|
thresholds: [0, 100],
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,10 +45,10 @@ export class Gauge extends PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
formatValue(value) {
|
formatValue(value) {
|
||||||
const { decimals, prefix, sufix, unit } = this.props;
|
const { decimals, prefix, suffix, unit } = this.props;
|
||||||
|
|
||||||
const formatFunc = kbn.valueFormats[unit];
|
const formatFunc = kbn.valueFormats[unit];
|
||||||
return `${prefix} ${formatFunc(value, decimals)} ${sufix}`;
|
return `${prefix} ${formatFunc(value, decimals)} ${suffix}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw() {
|
draw() {
|
||||||
|
Loading…
Reference in New Issue
Block a user