Skip to content
Commits on Source (2)
{
"name": "i4-js-commons",
"version": "3.9.9",
"version": "3.9.10",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "i4-js-commons",
"version": "3.9.9",
"version": "3.9.10",
"description": "Just a load of common stuff for i4 front-ends and some probably usable in back-end as well",
"dependencies": {
"@material-ui/core": "^4.8.0",
......
......@@ -123,13 +123,13 @@ const pointIntoChart = R.curry((chart, { length, ttl }, point) => {
let remove = 0;
if (ttl) {
remove = R.findIndex(R.lt(subSeconds(ttl)(x)))(chart.data.labels);
// console.log('ttl present:', ttl, length, chart.data.labels);
// console.log('Remove count:', remove);
chart.data.labels.splice(0, remove);
console.log('ttl present:', ttl, length);
console.log('Remove count:', remove);
} else if (length) {
remove = 1;
if (chronologicStart && chart.data.labels.length < length) remove = 0;
}
R.forEach(chart.data.labels.shift)(R.range(0, remove));
chart.data.labels.push(x);
// if (length && chronologicStart && chart.data.labels.length < length) remove = false;
// if (remove) chart.data.labels.shift();
......@@ -138,7 +138,8 @@ const pointIntoChart = R.curry((chart, { length, ttl }, point) => {
// if (!R.is(Object, val) && !R.is(Number, val) && !R.isNil(val)) val = { data: val };
// if (R.is(Object, val)) val.valueOf = () => 0;
ds.data.push(val);
ds.data.splice(0, remove);
// ds.data.splice(0, remove);
R.forEach(ds.data.shift)(R.range(0, remove));
// if (remove) ds.data.shift();
});
});
......@@ -171,7 +172,7 @@ export const Chart = ({
// const chartId = useRef(generateString(8));
useEffect(() => {
// console.log('Chart init:', type, data);
console.log('Chart init:', type, data, options, point, points, length, ttl);
if (!chart.current) {
/* eslint-disable no-param-reassign */
if (!Array.isArray(data.datasets)) data.datasets = [];
......