mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
This reverts commit 00557c9940.
This commit is contained in:
1 parent
00557c9940
commit
8f0c785f58
9 files changed
+2478
-1957
No files matched your search
@@ -150,7 +150,7 @@ export function BarChart(props: Props) {
|
||||
}
|
||||
};
|
||||
const options = merge(barOptions, customOptions);
|
||||
if (chartData.datasets.length == 0) {
|
||||
if (!chartData.datasets.length) {
|
||||
return <NoMetrics/>
|
||||
}
|
||||
return (
|
||||
@@ -170,17 +170,9 @@ export const memoryOptions: ChartOptions = {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
callback: (value: number | string): string => {
|
||||
if (typeof value == "string") {
|
||||
const float = parseFloat(value);
|
||||
if (float < 1) {
|
||||
return float.toFixed(3);
|
||||
}
|
||||
|
||||
return bytesToUnits(parseInt(value));
|
||||
}
|
||||
|
||||
return `${value}`;
|
||||
callback: value => {
|
||||
if (!value) return 0;
|
||||
return parseFloat(value) < 1 ? value.toFixed(3) : bytesToUnits(parseInt(value));
|
||||
},
|
||||
stepSize: 1
|
||||
}
|
||||
@@ -202,12 +194,11 @@ export const cpuOptions: ChartOptions = {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
callback: (value: number | string): string => {
|
||||
const float = parseFloat(`${value}`);
|
||||
if (float == 0) return "0";
|
||||
if (float < 10) return float.toFixed(3);
|
||||
if (float < 100) return float.toFixed(2);
|
||||
return float.toFixed(1);
|
||||
callback: value => {
|
||||
if (value == 0) return 0;
|
||||
if (value < 10) return value.toFixed(3);
|
||||
if (value < 100) return value.toFixed(2);
|
||||
return value.toFixed(1);
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
@@ -19,7 +19,10 @@ export interface ChartDataSet extends ChartDataSets {
|
||||
}
|
||||
|
||||
export interface ChartProps {
|
||||
data: ChartData;
|
||||
data: {
|
||||
labels?: Array<string | string[]>;
|
||||
datasets?: ChartDataSet[];
|
||||
};
|
||||
width?: number | string;
|
||||
height?: number | string;
|
||||
options?: ChartOptions; // Passed to ChartJS instance
|
||||
|
||||
@@ -7,6 +7,7 @@ import { cssNames } from "../../utils";
|
||||
import { themeStore } from "../../theme.store";
|
||||
|
||||
interface Props extends ChartProps {
|
||||
data: ChartData;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user