Bug #7477
Wt Axis zoomRangeChanged won’t fire when adding/removing a series
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
02/27/2020
Due date:
% Done:
0%
Estimated time:
Description
When I added or removed a series, the zoomRangeChanged didn't fire. It only fires when I zoom the chart.
The problem can be tested under ChartsExample.c
I added the code to subscribe zoom chart.
chart->axis(Wt::Chart::Axis::Y).zoomRangeChanged().connect([](double min, double max) { Wt::log("deeebug") << "y-min:" << min; Wt::log("deeebug") << "y-max:" << max; });
Then I clicked at the table to add a series. The Y axis range changed but no feedback to zoomRangeChanged()
Note that the xaxis.maximum()/maximum() is not exactly equal to xaxis.zoomMinimum()/zoomMaximum(). I need precise displayed range info. I have to rely on zoomRangeChanged().
Here is my quick-and-dirty patch to overcome the issue
diff --git a/src/js/WCartesianChart.js b/src/js/WCartesianChart.js index 20c23432..1a515d5d 100644 --- a/src/js/WCartesianChart.js +++ b/src/js/WCartesianChart.js @@ -414,6 +414,25 @@ WT_DECLARE_WT_MEMBER_BIG } }, TRANSFORM_CHANGED_TIMEOUT); } + + function setTransformChangedWithoutOldCheck() { + + if (!notifyAnyTransform()) + return; + + if (config.notifyTransform.x) { + APP.emit(target.widget, "xTransformChanged"); + assign(oldXTransform, xTransform()); + } + for (var i = 0; i < yAxisCount(); ++i) { + if (config.notifyTransform.y[i]) { + APP.emit(target.widget, "yTransformChanged" + i); + assign(oldYTransforms[i], yTransform(i)); + } + } + } + + var tAssign = function(a, b) { assign(a,b); setTransformChangedTimeout(); @@ -1634,6 +1653,7 @@ WT_DECLARE_WT_MEMBER_BIG refreshPenColors(); repaint(); notifyAreaChanged(); + setTransformChangedWithoutOldCheck(); } this.updateConfig({});
Files
No data to display