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
+1
View File
@@ -1,6 +1,7 @@
declare module '@fnando/sparkline' {
namespace sparkline {
export interface Options {
minScale?: number;
spotRadius?: number;
cursorWidth?: number;
interactive?: boolean;
+1 -1
View File
@@ -5,7 +5,7 @@
"license": "GPL-3.0",
"description": "Polkadot Telemetry frontend",
"dependencies": {
"@fnando/sparkline": "^0.3.10",
"@fnando/sparkline": "maciejhirsz/sparkline",
"polkadot-identicon": "^1.1.0",
"react": "16.4.0",
"react-dom": "16.4.0",
@@ -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,
});
+2 -2
View File
@@ -16,9 +16,9 @@
esutils "^2.0.2"
js-tokens "^3.0.0"
"@fnando/sparkline@^0.3.10":
"@fnando/sparkline@maciejhirsz/sparkline":
version "0.3.10"
resolved "https://registry.yarnpkg.com/@fnando/sparkline/-/sparkline-0.3.10.tgz#0cb6549a232af0f19f75b33d38fddd4f5ed9f086"
resolved "https://codeload.github.com/maciejhirsz/sparkline/tar.gz/2bdb002b171436be078a84f1e4e617a44ef1fb42"
"@tanem/svg-injector@^1.2.0":
version "1.2.1"