-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set domain to (0, 1) when no data is present (#1619)
* fix: set domain to (0, 1) when no data is present Fixes #1614 If no data is present, a scale has a domain of (0, 1) but if we remove the data (set it to an empty array) afterwards, we set it to (-inf, +inf) which causes rendering issues and make the bqplot figure unable to restore itself. It is more consistent to behave like no data was passed in, and use (0, 1) for the domain. * Update snapshots --------- Co-authored-by: martinRenou <martin.renou@gmail.com>
- Loading branch information
1 parent
dff8257
commit 1057c6b
Showing
6 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,17 @@ export class LinearScaleModel extends ScaleModel { | |
|
||
update_domain() { | ||
const that = this; | ||
// if all domains are empty, we reset to the default domain of (0, 1) | ||
if ( | ||
_.every(this.domains, (d) => { | ||
return d.length === 0; | ||
}) | ||
) { | ||
this.domain = this.reverse ? [1, 0] : [0, 1]; | ||
this.trigger('domain_changed', this.domain); | ||
return; | ||
} | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
martinRenou
Author
Member
|
||
const min = !this.min_from_data | ||
? this.min | ||
: d3.min( | ||
|
Binary file added
BIN
+12.6 KB
ui-tests/tests/bqplot.test.ts-snapshots/dark-lines-update-ipynb-cell-12-linux.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+55.5 KB
ui-tests/tests/bqplot.test.ts-snapshots/dark-lines-update-ipynb-cell-13-linux.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
ui-tests/tests/bqplot.test.ts-snapshots/light-lines-update-ipynb-cell-12-linux.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+53.8 KB
ui-tests/tests/bqplot.test.ts-snapshots/light-lines-update-ipynb-cell-13-linux.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This breaks the case where the domain is not set.
We're looking into having streaming data in ipydatagrid. In that case the front-end does not have access to the full data and cannot compute the domain.