[TASK] bugfix chart if array length less than 2
This commit is contained in:
parent
dd7709ec3f
commit
f92a913858
@ -8,6 +8,7 @@ export interface Data {
|
|||||||
if(sessionStorage.getItem('userStats')) {
|
if(sessionStorage.getItem('userStats')) {
|
||||||
const data = JSON.parse(sessionStorage.getItem('userStats') || '{}') as Data[];
|
const data = JSON.parse(sessionStorage.getItem('userStats') || '{}') as Data[];
|
||||||
|
|
||||||
|
if(data.length >= 2) {
|
||||||
const margin = { top: 20, right: 20, bottom: 50, left: 50 };
|
const margin = { top: 20, right: 20, bottom: 50, left: 50 };
|
||||||
const width: number = 960 - margin.left - margin.right;
|
const width: number = 960 - margin.left - margin.right;
|
||||||
const height: number = 500 - margin.top - margin.bottom;
|
const height: number = 500 - margin.top - margin.bottom;
|
||||||
@ -48,6 +49,7 @@ if(sessionStorage.getItem('userStats')) {
|
|||||||
|
|
||||||
svg.append('g')
|
svg.append('g')
|
||||||
.call(d3.axisLeft(y));
|
.call(d3.axisLeft(y));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user