JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://axibase.com/atsd/atsdClient.bundle.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="staticPlotContainer" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function() {
var startTime = Date.now() - 10 * 3600 * 1000,
endTime = Date.now();
var postData = [{
startTime: startTime,
endTime: endTime,
entity: "nurswgvml007",
metric: "disk_size",
timeFormat: "milliseconds",
tags: {
mount_point: ["/"]
},
aggregate: {
types: ["AVG"],
period: {
count: 15,
unit: "MINUTE"
}
}
}, {
startTime: startTime,
endTime: endTime,
entity: "nurswgvml007",
metric: "nmon.jfs_filespace_%used",
timeFormat: "milliseconds",
tags: {
id: ["/"]
},
aggregate: {
types: ["AVG"],
period: {
count: 15,
unit: "MINUTE"
}
}
}];
var client = axibase.atsdClient("https://axibase.com");
client.series.queries(postData)
.then(function(response) {
return response.reduce(function(previousValue, currentValue, index, array) {
if (currentValue.metric === "nmon.jfs_filespace_%used") {
previousValue["diskUsed"] = currentValue;
} else if (currentValue.metric === "disk_size") {
previousValue["diskSize"] = currentValue;
} else {
throw new Error("Error! Bad type found!!!");
}
return previousValue;
}, {});
})
.then(function(seriesMap) {
var...