mirror of
https://github.com/apotdevin/thunderhub.git
synced 2025-02-21 22:11:37 +01:00
fix: undefined error
This commit is contained in:
parent
e858cdd820
commit
6087e018ea
2 changed files with 6 additions and 2 deletions
|
@ -86,7 +86,9 @@ const Chart = ({
|
|||
|
||||
const axisColor = themeContext.mode === 'light' ? 'black' : 'white';
|
||||
|
||||
const keys = Object.keys(data[0]).filter(d => d !== 'date');
|
||||
const keys = Object.keys(data[0] || {}).filter(d => d !== 'date');
|
||||
|
||||
if (!keys.length) return null;
|
||||
|
||||
let tooltipTimeout: number;
|
||||
|
||||
|
|
|
@ -57,7 +57,9 @@ const Chart = ({
|
|||
const themeContext = useContext(ThemeContext);
|
||||
const axisColor = themeContext.mode === 'light' ? 'black' : 'white';
|
||||
|
||||
const keys = Object.keys(data[0]).filter(d => d !== 'label');
|
||||
const keys = Object.keys(data[0] || {}).filter(d => d !== 'label');
|
||||
|
||||
if (!keys.length) return null;
|
||||
|
||||
const maxValue = Math.max(
|
||||
...data.map(d => Math.max(...keys.map(key => Number(d[key]))))
|
||||
|
|
Loading…
Add table
Reference in a new issue