diff --git a/src/components/charts/Column.jsx b/src/components/charts/Column.jsx index 4be6328..0a7eea5 100644 --- a/src/components/charts/Column.jsx +++ b/src/components/charts/Column.jsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react' +import React, { useState, useEffect } from 'react' import { ChartTimeBase } from './ChartTimeBase' const chartPluginsOptions = { @@ -45,8 +45,10 @@ export const GetOrCreateDatasetByLineConfig = (data, lineConfig) => { return dataset } -export const Column = ({ lineGroup, data, postParsing, interval, yDisplay, yStart, pointCount, savePreviousData }) => { +export const Column = React.memo(({ lineGroup, data, postParsing, interval, yDisplay, yStart, pointCount, savePreviousData }) => { const [dataParams, setDataParams] = useState({data: {datasets:[]}, yStart, }) + if (!pointCount || !Number.isInteger(pointCount)) + pointCount = 2048 useEffect(()=>{ if((lineGroup.length === 0) || (data.length === 0)) return @@ -83,9 +85,4 @@ export const Column = ({ lineGroup, data, postParsing, interval, yDisplay, yStar }, [data, lineGroup, interval, yDisplay, yStart, postParsing, pointCount, savePreviousData]) return -} - -Column.defaultProps = { - pointCount: 2048, - savePreviousData: false -} +}) \ No newline at end of file