1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-11 13:50:06 +02:00
copilot/spikes/graphs-matrix/chartjs/client/chart/mem.js

29 lines
528 B
JavaScript
Raw Normal View History

2016-11-11 19:56:42 +02:00
const buildArray = require('build-array');
const Chart = require('./base');
const React = require('react');
const colors = {
user: 'rgb(255, 99, 132)',
sys: 'rgb(255, 159, 64)'
};
module.exports = ({
data = [],
windowSize
}) => {
const datasets = [{
label: 'mem',
backgroundColor: 'rgb(255, 99, 132)',
data: buildArray(windowSize).map((v, i) => ((data[i] || {}).used || 0))
}];
return (
<Chart
datasets={datasets}
labels={datasets[0].data.length}
legend={true}
/>
);
};