Different metrics get different fill colors

This commit is contained in:
Simon Howe
2016-03-14 12:45:23 +01:00
parent 0df2a2bce4
commit 439b3aaed8
6 changed files with 30 additions and 11 deletions

View File

@@ -87,7 +87,7 @@ const METRIC_FORMATS = {
load1: 'number',
load15: 'number',
load5: 'number',
open_files_count: 'number',
open_files_count: 'integer',
process_cpu_usage_percent: 'percent',
process_memory_usage_bytes: 'filesize'
};
@@ -128,3 +128,17 @@ export function getMetricValue(metric, size) {
formattedValue: formatMetric(value, metricWithFormat, true)
};
}
export function getMetricColor() {
const selectedMetric = AppStore.getSelectedMetric();
if (/memory/.test(selectedMetric)) {
return '#1f77b4';
} else if (/cpu/.test(selectedMetric)) {
return '#2ca02c';
} else if (/files/.test(selectedMetric)) {
return '#9467bd';
} else if (/load/.test(selectedMetric)) {
return '#17becf';
}
return 'steelBlue';
}