-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Region add/remove issues #3037
Comments
@eamodio, note that The key name should be chart.regions.remove({
classes: ['visible-area']
}); So, from the checkout the example: |
@netil Thanks -- that seems to fix a lot of the issues I was seeing. It looks like the typings are wrong for the I think the issue I am still seeing is related to the animation when a region comes into view. Is there a way to turn that off? I am trying to update a region while scrolling another list, and it seems to kind of hide and show the region almost sporadically Here I am scrolling down a line at a time, and it should be updating the region on each one, but something odd is happening. |
@eamodio, thanks for inform the incorrect type definition.
Will be fixed ASAP.
The easiest way is turning off the transition by specifying Just turning off on For the workaround, you can disable transition before the grid API call, and then re-enable it after the grid API call. In this case you can control when to use transition and when to not. |
Fix wrong .grid API parameter type Ref naver#3037
Fix wrong .grid API parameter type Ref #3037
@netil Thanks! Turning the transition off did the trick. Yeah, it would be nice for finer-grained control on that if possible (e.g. just for the regions). I also don't know if it would help optimize layout/repaint, but it could be nice to have a |
## [3.7.2](3.7.1...3.7.2) (2023-01-19) ### Bug Fixes * **api:** Fix tooltip.hide() error call for Arc types ([163495b](163495b)), closes [#3038](#3038) * **bar:** Fix drawing on inverted axis ([d25bf31](d25bf31)), closes [#3049](#3049) * **type:** fix wrong .grid() API param type ([0ef8a51](0ef8a51)), closes [#3037](#3037)
@netil Thanks for the typing updates. Though I noticed an issue, with the new changes: The export interface RegionOptions {
axis?: string;
start?: string | number | Date;
end?: string | number | Date;
class?: string;
} regions: {
/**
* Update regions.
* @param regions Regions will be replaced with this argument. The format of this argument is the same as regions.
*/
(regions: Array<{
axis: "x" | "y" | "y2",
start?: number | Date,
end?: number | Date,
class?: string
}>): void;
/**
* Add new region. This API adds new region instead of replacing like regions.
* @param grids New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added.
*/
add<T = {
axis: "x" | "y" | "y2",
start?: number | Date,
end?: number | Date,
class?: string
}>(regions: T | T[]): void;
/**
* Remove regions. This API removes regions.
* @param args This argument should include classes. If classes is given, the regions that have one of the specified classes will be removed. If args is not given, all of regions will be
* removed.
*/
remove(args?: { classes: string[] }): void;
}; |
@eamodio thanks for reporting. |
## [3.7.3](3.7.2...3.7.3) (2023-01-26) ### Bug Fixes * **bar:** Fix bar radius on inverted axis ([21b7004](21b7004)), closes [#3054](#3054) * **data:** Fix ratio calculation ([519cd0d](519cd0d)), closes [#3055](#3055) * **type:** align grid api with option interface ([b89b74a](b89b74a)), closes [#3037](#3037)
Related to my comment here: #3037 (comment) Thoughts on a My use-case is here: gitkraken/vscode-gitlens#2477 |
I should probably open a new issue, but just to get this down in writing: In both Billboard.js (and C3), there's an undocumented region option, The setting of the opacity seems to happen on line 66 in .style("fill-opacity", d => (isValue(d.opacity) ? d.opacity : null)) |
Currently, when call grid APIs it goes redrawing the chart. I'll be refactoring only to perform on grid related elements. |
- remove .redrawWithoutRescale() and replace its call to grid/regions APIs directly to reduce performance burden - remove separated grid.x.ts, grid.y.ts files and merge into grid.ts Ref naver#3037
- remove .redrawWithoutRescale() and replace its call to grid/regions APIs directly to reduce performance burden - remove separated grid.x.ts, grid.y.ts files and merge into grid.ts Ref #3037
Sweet - looking forward to checking it out! |
@eamodio you can use |
@netil I've tried out the latest version ( In the above case, I was updating the And because I'm updating those visible regions on scroll, it generates LOTS of those extra It seems like it might be related to this code: billboard.js/src/ChartInternal/internals/region.ts Lines 46 to 48 in c8e1a92
|
released |
@netil looks great! TY |
If I set the
chart.regions
directly things seem to work fine, but I'm trying to dynamically add/remove "classes" of regions.I am using regions as both "markers" and shaded regions and I have multiple different types of regions each with their own "class".
When I try to update a set of regions for a single "class" using
chart.regions.remove
and thenchart.regions.add
things don't seem to work properly. Sometimes it seems like theremove
call removes markers that don't have that class, but then other times seems to fail to remove even markers of that class as I see them keep overlaying on top of one another.Here is an example of my code:
Should this work? Or am I not understanding how the remove/add calls are supposed to work?
The text was updated successfully, but these errors were encountered: