Looking into https://www.scichart.com/documentation/js/current/typedoc/classes/scichartverticalgroup.html I see I can add surfaces to the group, but what about removing them?
I’ve constructed a problematic codepen to show a potential issue:
https://codepen.io/jrfv/full/JjwraLK
Any reason for not being able to remove surfaces from the group?
Thanks!
- João Velasques asked 1 year ago
-
Hi Joao, really good bug report, allow us some time to look into this and get back to you. In the meantime I created task https://abtsoftware.myjetbrains.com/youtrack/issue/SCJS-1603/Add-SciChartVerticalGroup-removeSurface-functionality. Thanks!
- You must login to post comments
So for reference. Now SciChartVerticalGroup has a method for removing a surface subscription.
verticalGroup.removeSurface(sciChartSurface)
Also, notice that it is called internally when the surface is being deleted.
- Jim Risen answered 1 year ago
- You must login to post comments
Hello, we are working on a proper fix.
Meanwhile, try using a workaround by adding
verticalGroup.layoutManagers.pop()
when removing a chart.
- Jim Risen answered 1 year ago
- You must login to post comments
Wouldn’t that possibly leave groupLeftSize
and groupRightSize
with wrong values?
I’m using my own makeshift class for now:
class VerticalAlignedGroup extends SciChartVerticalGroup {
removeSurfaceFromGroup(surface) {
const idx = this.layoutManagers.findIndex(
(l) => l.sciChartSurface.id === surface.id
);
if (idx !== -1) {
const synchronisedLayoutManager = this.layoutManagers[idx];
this.layoutManagers.splice(idx, 1);
// might get away with a custom object with mocked functions, as this
// won't contribute to actual layout, and should be GC'ed soon
synchronisedLayoutManager.verticalGroup = new SciChartVerticalGroup();
this.onLeftSizeChanged(synchronisedLayoutManager.id, 0);
this.onRightSizeChanged(synchronisedLayoutManager.id, 0);
this.synchronizeAxisSizes();
}
}
}
- João Velasques answered 1 year ago
- last edited 1 year ago
-
Right, that will not reset the layout sizes on other surfaces of the chart. So you need a way to recalculate them. Your approach looks good.
-
Update for both Jim & Joao. Did we add a function into SciChartVerticalGroup to remove a chart? And if so have we released?
-
I do notice it is present already in version 3.2.481. Upgrading today!
- You must login to post comments
Please login first to submit.