Skip to content

Commit c902def

Browse files
author
Lijun Zhang
committed
DM-9343:
Reset zoom when the x or y column changes
1 parent 8ac0c39 commit c902def

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/firefly/js/charts/ui/XYPlotOptions.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ function getUnit(colValStats, colname) {
5252
}
5353
*/
5454

55-
export function resultsSuccess(callback, flds, tblId, zoom) {
55+
export function resultsSuccess(callback, flds, optionParameters) {
56+
const tblId = optionParameters.tblId;
57+
5658
const xName = get(flds, ['x.columnOrExpr']);
5759
const yName = get(flds, ['y.columnOrExpr']);
60+
61+
const zoom = (xName!==optionParameters.x.columnOrExpr || yName!==optionParameters.y.columnOrExpr)? undefined:optionParameters.zoom;
5862
const xErr = get(flds, ['x.error']);
5963
const yErr = get(flds, ['y.error']);
6064

@@ -78,6 +82,7 @@ export function resultsSuccess(callback, flds, tblId, zoom) {
7882
userSetBoundaries = isEmpty(userSetBoundaries) ? undefined : userSetBoundaries;
7983
const xyRatio = parseFloat(flds.xyRatio);
8084

85+
8186
/*
8287
const axisParamsShape = PropTypes.shape({
8388
columnOrExpr : PropTypes.string,
@@ -454,6 +459,7 @@ export class XYPlotOptions extends React.Component {
454459
}
455460

456461
render() {
462+
457463
const { colValStats, groupKey, xyPlotParams, defaultParams, onOptionsSelected}= this.props;
458464

459465
const largeTable = possibleDecimatedTable(colValStats);
@@ -462,6 +468,7 @@ export class XYPlotOptions extends React.Component {
462468
const yProps = {colValStats,params:xyPlotParams,groupKey,fldPath:'y.columnOrExpr',label:'Y',tooltip:'Y Axis',nullAllowed:false};
463469
const xErrProps = {colValStats,params:xyPlotParams,groupKey,fldPath:'x.error',label:'X Err',tooltip:'X Error',nullAllowed:true};
464470
const yErrProps = {colValStats,params:xyPlotParams,groupKey,fldPath:'y.error',label:'Y Err',tooltip:'Y Error',nullAllowed:true};
471+
465472
return (
466473
<div style={{padding:'0 5px 7px'}}>
467474
<FieldGroup groupKey={groupKey} validatorFunc={null} keepState={true}
@@ -470,7 +477,7 @@ export class XYPlotOptions extends React.Component {
470477
<div style={{display: 'flex', flexDirection: 'row', padding: '5px 0 15px'}}>
471478
<CompleteButton style={{flexGrow: 0}}
472479
groupKey={groupKey}
473-
onSuccess={(flds) => resultsSuccess(onOptionsSelected, flds, xyPlotParams.tblId, xyPlotParams.zoom)}
480+
onSuccess={(flds) => resultsSuccess(onOptionsSelected, flds, xyPlotParams)}
474481
onFail={resultsFail}
475482
text = 'Apply'
476483
/>

0 commit comments

Comments
 (0)