Skip to content

DM-9343:scatter and line chart zoom changed when changing between "points" and "connected points" #321

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

Merged
merged 3 commits into from
Mar 1, 2017

Conversation

lznakano
Copy link
Contributor

Fixed bug after zoom

Pease check:

  1. If the bug is fixed.
  2. If the way of fixing is appropriate.

Thanks!

@ejoliet
Copy link
Contributor

ejoliet commented Feb 27, 2017

It works great for me.
I've noticed that the reset button does not re-select (radio button UI) the default initial type of line. But when clicking 'apply' it surely did. Is just that the option is not visible. Weird.

This might be introduced with your change, not sure, i just wanted to mention it to you.

Otherwise, please, raise a separate ticket for the reset problem to be looked in the future.

Copy link
Contributor

@tgoldina tgoldina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the right way to fix the issue is to preserve zoom level in XYPlotOptions if x and y columns did not change.

  1. Modify resultSuccess in XYPlotOptions to optionally pass current zoom or undefined.

  2. Pass xyPlotParams.zoom in onSuccess callback of CompleteButton on line 472 of XYPlotOptions (if x.columnOrExpr and y.columnOrExpr columns did not change from what is in xyPlotParams)

I am not even sure we should bother removing zoom when the new data are fetched.

@@ -194,7 +194,9 @@ export function setZoom(chartId, chartDataElementId, selection=undefined) {
if (decimatedUnzoomed || isUndefined(decimatedUnzoomed)) {
noFetch = false;
}
dispatchChartOptionsUpdate({chartId, chartDataElementId, updates: {zoom: xyPlotParams.selection, selection: undefined}, noFetch});
dispatchChartOptionsUpdate({chartId, chartDataElementId, updates: {zoom: xyPlotParams.boundaries, selection: undefined}, noFetch});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said this morning, you should not use boundaries property, it has nothing to do with zoom. Using it messes up setting min and max values for plot axes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain to me why it messed up setting min and max? I looked at the algorithm used and did not see it messing up the setting. Maybe I did not understand the algorithm.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your approach "if the zoom is in the old options, copy it to the new options" is correct. Just do it in XYPlotOptions and only use "zoom" field. Currently, every time we press "Apply" button in options dialog, zoom is gone. We want to preserve it, unless X or Y columns changed.

We use "zoom" field to track zoom and "boundaries" field to track data or user boundaries. "boundaries" is a calculated field and should never be set directly.

Because you clear boundaries, not zoom, the unzoom icon does not disappear when the chart is unzoomed.

When I said that using boundaries messes up setting min and max values, I was wrong. I noticed that zooming up and then setting min/max value does not work. But the real cause of this behavior is a bug in lines 376-377 of XYPlot. If both zoom and data boundaries are present, min/max of the two should be taken as an axis min/max. I would appreciate if you fix it too. (Or I can fix it later in your branch.)


if (!newOptions.zoom && oldOptions.zoom && !areAllValuesEaual(oldOptions.zoom,oldOptions.boundaries)){
newOptions.zoom = oldOptions.zoom;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no references to scatter plot specific options (zoom or boundaries) in Charts controller, which is designed to deal with all chart types.

Fixed the zoom bug
@@ -107,7 +107,8 @@ export function resultsSuccess(callback, flds, tblId) {
shading: flds.shading || undefined,
x : { columnOrExpr : xName, error: xErr, label : xLabel, unit : xUnit, options : xOptions},
y : { columnOrExpr : yName, error: yErr, label : yLabel, unit : yUnit, options : yOptions},
tblId
tblId,
zoom,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, do not preserve zoom if X or Y column changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. When the columns change, the zoom should not be preserved. Thanks for pointing it out. I did not realize it.

Lijun Zhang and others added 2 commits February 28, 2017 16:05
@lznakano lznakano merged commit 4f1fc7e into dev Mar 1, 2017
@lznakano lznakano deleted the DM-9343-ChartZoom branch March 1, 2017 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants