diff --git a/admin/src/System/CallChart.js b/admin/src/System/CallChart.js index 21094bb..a117472 100644 --- a/admin/src/System/CallChart.js +++ b/admin/src/System/CallChart.js @@ -26,14 +26,14 @@ const CallChart = (props) => { const parseDate = timeParse("%Y%m%d"); const format = timeFormat("%b %d"); const formatDate = (date) => format(parseDate(date)); - + const parseTime = timeParse('%Y-%m-%dT%H:%M:%S.%LZ'); // Then we'll create some bounds const xMax = width - margin.left - margin.right; const yMax = height - margin.top - margin.bottom; // accessors - const x = d => d.x; - const y = d => d.y; + //const x = d => d.x; + //const y = d => d.y; var xScale, yScale; if (callData) { @@ -50,7 +50,9 @@ const CallChart = (props) => { }); } - + // accessors + const x = d => xScale(d.x); + const y = d => yScale(d.y); return ( @@ -60,18 +62,15 @@ const CallChart = (props) => { data={callTotals} x={x} y={y} - xScale={xScale} - yScale={yScale} + strokeWidth={2} - stroke="#333" + stroke="blue" curve={curveStep} /> { const freqErrors = errors[freq]; var data = []; 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); if (time < minDate) minDate = time; @@ -106,7 +106,7 @@ const System = () => { var MS_PER_MINUTE = 60000; if (statistic) { 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); if (time < minDate) minDate = time; if (statistic.callTotals[j] > maxValue) @@ -238,11 +238,11 @@ const System = () => { }, [groupsData]) useEffect(() => { - if (isSystemsSuccess) { + if (isSystemsSuccess && systemsData.stats[shortName]) { processStatistics(systemsData.stats[shortName]) processErrors(systemsData.stats[shortName]) } - }, [isSystemsSuccess]); + }, [isSystemsSuccess, systemsData]); /* useEffect(() => { if (isErrorsSuccess) {