Skip to content

Commit

Permalink
fix null issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rzats committed Feb 27, 2024
1 parent 35616b4 commit 2affbc7
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/components/Chart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,23 @@
include: DataSet | DataGroup | null = null,
exclude: DataSet | DataGroup | null = null,
): void {
if (datasets.length === 0) {
if (datasets.length === 0 && !include) {
return;
}
if (datasets.length === 1 && exclude) {
return;
}
const temp = datasets[0].data;
let _xMin = temp[0].getDate().getIndex() - 0.5;
let _xMax = temp[temp.length - 1].getDate().getIndex() + 0.5;
let _yMin = datasets[0].getPointValue(0);
let temp = null;
if (datasets.length === 0 && include) {
temp = include;
} else if (datasets[0] && datasets[0] == exclude) {
temp = datasets[1];
} else {
temp = datasets[0];
}
let _xMin = temp.data[0].getDate().getIndex() - 0.5;
let _xMax = temp.data[temp.data.length - 1].getDate().getIndex() + 0.5;
let _yMin = temp.getPointValue(0);
let _yMax = _yMin;
let dss = null;
if (include) {
Expand Down

0 comments on commit 2affbc7

Please sign in to comment.