Set CPU scale to 100% at minimum (#71)

This commit is contained in:
Maciej Hirsz
2018-09-30 20:41:17 +02:00
committed by GitHub
parent 51fb2cf326
commit 58e19a7c58
5 changed files with 8 additions and 5 deletions
@@ -140,7 +140,7 @@ export default class Row extends React.Component<RowProps, {}> {
}
return (
<Sparkline width={48} height={16} stroke={1} format={formatCPU} values={cpu} />
<Sparkline width={48} height={16} stroke={1} format={formatCPU} values={cpu} minScale={100} />
);
}
},
@@ -10,6 +10,7 @@ export namespace Sparkline {
width: number;
height: number;
values: number[];
minScale?: number;
format?: (value: number) => string;
}
}
@@ -26,7 +27,7 @@ export class Sparkline extends React.Component<Sparkline.Props, {}> {
}
public shouldComponentUpdate(nextProps: Sparkline.Props): boolean {
const { stroke, width, height, format } = this.props;
const { stroke, width, height, minScale, format } = this.props;
if (stroke !== nextProps.stroke || width !== nextProps.width || height !== nextProps.height || format !== nextProps.format) {
return true;
@@ -34,6 +35,7 @@ export class Sparkline extends React.Component<Sparkline.Props, {}> {
if (this.props.values !== nextProps.values) {
sparkline(this.el, nextProps.values, {
minScale,
interactive: true,
onmousemove: this.onMouseMove,
});