Fix chopped off data for twelve hours
This commit is contained in:
parent
20b0392f7f
commit
d9623437f1
@ -121,7 +121,8 @@ class Graph extends React.Component {
|
|||||||
// remove leading data before first time on scale x
|
// remove leading data before first time on scale x
|
||||||
let dataWithTime = [];
|
let dataWithTime = [];
|
||||||
if(data && data.length) {
|
if(data && data.length) {
|
||||||
const totalData = data.slice(data.length - 1 - duration/10);
|
const sliceIndex = data.length - 1 - duration/10;
|
||||||
|
const totalData = sliceIndex < 0 ? data : data.slice(sliceIndex);
|
||||||
// adjust time of first data, if there's less data than would fill the chart
|
// adjust time of first data, if there's less data than would fill the chart
|
||||||
const start = moment(before)
|
const start = moment(before)
|
||||||
.add(duration - (totalData.length-1)*10, 'minutes');
|
.add(duration - (totalData.length-1)*10, 'minutes');
|
||||||
|
@ -80,7 +80,7 @@ storiesOf('Metric', module)
|
|||||||
<MetricView>
|
<MetricView>
|
||||||
<MetricHeader>
|
<MetricHeader>
|
||||||
<MetricTitle>Aggregated CPU usage</MetricTitle>
|
<MetricTitle>Aggregated CPU usage</MetricTitle>
|
||||||
<MetricSelect onChange={onMetricSelect} value={twoDays}>
|
<MetricSelect onChange={onMetricSelect} value={twelveHours}>
|
||||||
<option value={sixHours}>6 hours</option>
|
<option value={sixHours}>6 hours</option>
|
||||||
<option value={twelveHours}>12 hours</option>
|
<option value={twelveHours}>12 hours</option>
|
||||||
<option value={oneDay}>24 hours</option>
|
<option value={oneDay}>24 hours</option>
|
||||||
@ -93,11 +93,33 @@ storiesOf('Metric', module)
|
|||||||
</MetricHeader>
|
</MetricHeader>
|
||||||
<MetricGraph
|
<MetricGraph
|
||||||
data={kbMetricData}
|
data={kbMetricData}
|
||||||
duration={oneDay}
|
duration={twelveHours}
|
||||||
yMax={2.0}
|
yMax={2.0}
|
||||||
yMeasurement='kb'
|
yMeasurement='kb'
|
||||||
yMin={1.55}
|
yMin={1.55}
|
||||||
/>
|
/>
|
||||||
</MetricView>
|
</MetricView>
|
||||||
|
<MetricView>
|
||||||
|
<MetricHeader>
|
||||||
|
<MetricTitle>Aggregated CPU usage</MetricTitle>
|
||||||
|
<MetricSelect onChange={onMetricSelect} value={oneDay}>
|
||||||
|
<option value={sixHours}>6 hours</option>
|
||||||
|
<option value={twelveHours}>12 hours</option>
|
||||||
|
<option value={oneDay}>24 hours</option>
|
||||||
|
<option value={twoDays}>Two days</option>
|
||||||
|
</MetricSelect>
|
||||||
|
<MetricSettingsButton onClick={onButtonClick}>
|
||||||
|
Settings
|
||||||
|
</MetricSettingsButton>
|
||||||
|
<MetricCloseButton onClick={onButtonClick} />
|
||||||
|
</MetricHeader>
|
||||||
|
<MetricGraph
|
||||||
|
data={percentageMetricData}
|
||||||
|
duration={oneDay}
|
||||||
|
yMax={100}
|
||||||
|
yMeasurement='%'
|
||||||
|
yMin={0}
|
||||||
|
/>
|
||||||
|
</MetricView>
|
||||||
</Base>
|
</Base>
|
||||||
));
|
));
|
||||||
|
Loading…
Reference in New Issue
Block a user