2016-11-18 14:28:37 +02:00
|
|
|
const pretty = require('prettysize');
|
|
|
|
const buildArray = require('build-array');
|
|
|
|
const Chart = require('./base');
|
|
|
|
const React = require('react');
|
|
|
|
|
|
|
|
const colors = {
|
2016-11-21 16:09:52 +02:00
|
|
|
perc: 'rgba(54, 74, 205, 0.2)',
|
|
|
|
alt: 'rgba(245, 93, 93, 0.2)'
|
2016-11-18 14:28:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = ({
|
|
|
|
data = [],
|
|
|
|
windowSize
|
|
|
|
}) => {
|
|
|
|
const datasets = [{
|
|
|
|
label: 'disk',
|
2016-11-21 16:09:52 +02:00
|
|
|
backgroundColor: colors['perc'],
|
|
|
|
altBackgroundColor: colors['alt'],
|
|
|
|
data: buildArray(windowSize).map((v, i) => ((data[i] || {})['perc'] || { firstQuartile: 0, thirdQuartile: 0, median: 0, max: 0, min: 0 })).reverse()
|
2016-11-18 14:28:37 +02:00
|
|
|
}];
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Chart
|
|
|
|
datasets={datasets}
|
2016-11-21 16:09:52 +02:00
|
|
|
labels={datasets[0].data.length}
|
2016-11-18 14:28:37 +02:00
|
|
|
legend={true}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|