Carbon µPlot

CPU utilization — 24h

CPU utilization — single series

CPU utilization — legend top

CPU utilization — no legend

Disk I/O — custom series colors

Memory breakdown — value & tooltip time formatters

CPU utilization — toggle points

CPU utilization — points suppressed

CPU utilization — 24h


import { createAreaChart } from 'carbon-uplot';

createAreaChart(el, {
  data: [timestamps, cpuSeriesA, cpuSeriesB, cpuSeriesC],
  yRange: [0, 100],
  series: [
    { label: 'prod-vsi-01' },
    { label: 'prod-vsi-02' },
    { label: 'prod-vsi-03' },
  ],
});

CPU utilization — single series


import { createAreaChart } from 'carbon-uplot';

createAreaChart(el, {
  data: [timestamps, cpuSeriesC],
  yRange: [0, 100],
  series: [{ label: 'CPU' }],
});

CPU utilization — legend top


import { createAreaChart } from 'carbon-uplot';

createAreaChart(el, {
  data: [timestamps, cpuSeriesA, cpuSeriesB, cpuSeriesC],
  yRange: [0, 100],
  series: [
    { label: 'prod-vsi-01' },
    { label: 'prod-vsi-02' },
    { label: 'prod-vsi-03' },
  ],
  legend: 'top',
});

CPU utilization — no legend


import { createAreaChart } from 'carbon-uplot';

createAreaChart(el, {
  data: [timestamps, cpuSeriesA, cpuSeriesB, cpuSeriesC],
  yRange: [0, 100],
  series: [
    { label: 'prod-vsi-01' },
    { label: 'prod-vsi-02' },
    { label: 'prod-vsi-03' },
  ],
  legend: false,
});

Disk I/O — custom series colors


import { createAreaChart } from 'carbon-uplot';

createAreaChart(el, {
  data: [timestamps, diskReads, diskWrites, diskAwait],
  yRange: [0, 350],
  series: [
    { label: 'reads/s', color: '#ff7eb6' },
    { label: 'writes/s', color: '#42be65' },
    { label: 'await (ms)', color: '#f1c21b' },
  ],
});

Memory breakdown — value & tooltip time formatters


import { createAreaChart } from 'carbon-uplot';

function valueFormat(value) {
  return `${(value / 1024).toFixed(1)} GB`;
}

function xFormat(timestamp) {
  return new Date(timestamp * 1000).toLocaleString(undefined, {
    month: 'short',
    day: 'numeric',
    hour: 'numeric',
    minute: '2-digit',
  });
}

createAreaChart(el, {
  data: [timestamps, memUsed, memCached, memBuffers],
  series: [{ label: 'Used' }, { label: 'Cached' }, { label: 'Buffers' }],
  valueFormat,
  xFormat,
});

CPU utilization — toggle points


import { createAreaChart } from 'carbon-uplot';

let showPoints = true;
let chart = buildChart(showPoints);

button.addEventListener('click', () => {
  showPoints = !showPoints;
  chart.destroy();
  chart = buildChart(showPoints);
});

function buildChart(show) {
  return createAreaChart(el, {
    data: [timestamps, cpuSeriesA, cpuSeriesB, cpuSeriesC],
    yRange: [0, 100],
    series: [
      { label: 'prod-vsi-01', points: { show } },
      { label: 'prod-vsi-02', points: { show } },
      { label: 'prod-vsi-03', points: { show } },
    ],
  });
}

CPU utilization — points suppressed


import { createAreaChart } from 'carbon-uplot';

createAreaChart(el, {
  data: [timestamps, cpuSeriesA, cpuSeriesB, cpuSeriesC],
  yRange: [0, 100],
  series: [
    { label: 'prod-vsi-01', points: { show: false } },
    { label: 'prod-vsi-02', points: { show: false } },
    { label: 'prod-vsi-03', points: { show: false } },
  ],
});