mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-13 01:07:42 -05:00
chart is working!
This commit is contained in:
@@ -26,14 +26,14 @@ const CallChart = (props) => {
|
|||||||
const parseDate = timeParse("%Y%m%d");
|
const parseDate = timeParse("%Y%m%d");
|
||||||
const format = timeFormat("%b %d");
|
const format = timeFormat("%b %d");
|
||||||
const formatDate = (date) => format(parseDate(date));
|
const formatDate = (date) => format(parseDate(date));
|
||||||
|
const parseTime = timeParse('%Y-%m-%dT%H:%M:%S.%LZ');
|
||||||
// Then we'll create some bounds
|
// Then we'll create some bounds
|
||||||
const xMax = width - margin.left - margin.right;
|
const xMax = width - margin.left - margin.right;
|
||||||
const yMax = height - margin.top - margin.bottom;
|
const yMax = height - margin.top - margin.bottom;
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
const x = d => d.x;
|
//const x = d => d.x;
|
||||||
const y = d => d.y;
|
//const y = d => d.y;
|
||||||
|
|
||||||
var xScale, yScale;
|
var xScale, yScale;
|
||||||
if (callData) {
|
if (callData) {
|
||||||
@@ -50,7 +50,9 @@ const CallChart = (props) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// accessors
|
||||||
|
const x = d => xScale(d.x);
|
||||||
|
const y = d => yScale(d.y);
|
||||||
return (
|
return (
|
||||||
<svg width={width} height={height}>
|
<svg width={width} height={height}>
|
||||||
<Group left={margin.left} top={margin.top}>
|
<Group left={margin.left} top={margin.top}>
|
||||||
@@ -60,18 +62,15 @@ const CallChart = (props) => {
|
|||||||
data={callTotals}
|
data={callTotals}
|
||||||
x={x}
|
x={x}
|
||||||
y={y}
|
y={y}
|
||||||
xScale={xScale}
|
|
||||||
yScale={yScale}
|
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
stroke="#333"
|
stroke="blue"
|
||||||
curve={curveStep}
|
curve={curveStep}
|
||||||
/>
|
/>
|
||||||
<LinePath
|
<LinePath
|
||||||
data={uploadErrors}
|
data={uploadErrors}
|
||||||
x={x}
|
x={x}
|
||||||
y={y}
|
y={y}
|
||||||
xScale={xScale}
|
|
||||||
yScale={yScale}
|
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
stroke="red"
|
stroke="red"
|
||||||
curve={curveStep}
|
curve={curveStep}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ const System = () => {
|
|||||||
const freqErrors = errors[freq];
|
const freqErrors = errors[freq];
|
||||||
var data = [];
|
var data = [];
|
||||||
for (var i = 0; i < freqErrors.errorHistory.length; i++) {
|
for (var i = 0; i < freqErrors.errorHistory.length; i++) {
|
||||||
let spotsBack = freqErrors.errorHistory.length - i;
|
let spotsBack = i; //freqErrors.errorHistory.length - i;
|
||||||
let time = new Date(now - spotsBack * 15 * MS_PER_MINUTE);
|
let time = new Date(now - spotsBack * 15 * MS_PER_MINUTE);
|
||||||
if (time < minDate) minDate = time;
|
if (time < minDate) minDate = time;
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ const System = () => {
|
|||||||
var MS_PER_MINUTE = 60000;
|
var MS_PER_MINUTE = 60000;
|
||||||
if (statistic) {
|
if (statistic) {
|
||||||
for (let j = 0; j < statistic.callTotals.length; j++) {
|
for (let j = 0; j < statistic.callTotals.length; j++) {
|
||||||
let spotsBack = statistic.callTotals.length - j;
|
let spotsBack = j;//statistic.callTotals.length - j;
|
||||||
let time = new Date(now - spotsBack * 15 * MS_PER_MINUTE);
|
let time = new Date(now - spotsBack * 15 * MS_PER_MINUTE);
|
||||||
if (time < minDate) minDate = time;
|
if (time < minDate) minDate = time;
|
||||||
if (statistic.callTotals[j] > maxValue)
|
if (statistic.callTotals[j] > maxValue)
|
||||||
@@ -238,11 +238,11 @@ const System = () => {
|
|||||||
}, [groupsData])
|
}, [groupsData])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isSystemsSuccess) {
|
if (isSystemsSuccess && systemsData.stats[shortName]) {
|
||||||
processStatistics(systemsData.stats[shortName])
|
processStatistics(systemsData.stats[shortName])
|
||||||
processErrors(systemsData.stats[shortName])
|
processErrors(systemsData.stats[shortName])
|
||||||
}
|
}
|
||||||
}, [isSystemsSuccess]);
|
}, [isSystemsSuccess, systemsData]);
|
||||||
/*
|
/*
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isErrorsSuccess) {
|
if (isErrorsSuccess) {
|
||||||
|
|||||||
Reference in New Issue
Block a user