@@ -34,6 +34,8 @@ import {PopupPanel} from '../ui/PopupPanel.jsx';
34
34
import DialogRootContainer from '../ui/DialogRootContainer.jsx' ;
35
35
import { dispatchShowDialog , dispatchHideDialog , isDialogVisible } from '../core/ComponentCntlr.js' ;
36
36
37
+ import { showInfoPopup } from '../ui/PopupUtil.jsx' ;
38
+
37
39
import OUTLINE_EXPAND from 'html/images/icons-2014/24x24_ExpandArrowsWhiteOutline.png' ;
38
40
import SETTINGS from 'html/images/icons-2014/24x24_GearsNEW.png' ;
39
41
import ZOOM_IN from 'html/images/icons-2014/24x24_ZoomIn.png' ;
@@ -322,23 +324,28 @@ class ChartsPanel extends React.Component {
322
324
323
325
addSelection ( ) {
324
326
if ( this . state . chartType === SCATTER ) {
325
- const { tblId, tableModel} = this . props ;
326
- const selection = get ( this . props , 'tblPlotData.xyPlotParams.selection' ) ;
327
- const rows = get ( this . props , 'tblPlotData.xyPlotData.rows' ) ;
328
- if ( tableModel && rows && selection ) {
329
- const { xMin, xMax, yMin, yMax} = selection ;
330
- const selectInfoCls = SelectInfo . newInstance ( { rowCount : tableModel . totalRows } ) ;
331
- // add all rows which fall into selection
332
- const xIdx = 0 , yIdx = 1 ;
333
- rows . forEach ( ( arow , index ) => {
334
- const x = Number ( arow [ xIdx ] ) ;
335
- const y = Number ( arow [ yIdx ] ) ;
336
- if ( x >= xMin && x <= xMax && y >= yMin && y <= yMax ) {
337
- selectInfoCls . setRowSelect ( index , true ) ;
338
- }
339
- } ) ;
340
- const selectInfo = selectInfoCls . data ;
341
- TablesCntlr . dispatchTableSelect ( tblId , selectInfo ) ;
327
+ if ( get ( this . props , 'tblPlotData.xyPlotData.decimateKey' ) ) {
328
+ showInfoPopup ( 'Your data set is too large to select. You must filter it down first.' ,
329
+ `Can't Select` ) ; // eslint-disable-line quotes
330
+ } else {
331
+ const { tblId, tableModel} = this . props ;
332
+ const selection = get ( this . props , 'tblPlotData.xyPlotParams.selection' ) ;
333
+ const rows = get ( this . props , 'tblPlotData.xyPlotData.rows' ) ;
334
+ if ( tableModel && rows && selection ) {
335
+ const { xMin, xMax, yMin, yMax} = selection ;
336
+ const selectInfoCls = SelectInfo . newInstance ( { rowCount : tableModel . totalRows } ) ;
337
+ // add all rows which fall into selection
338
+ const xIdx = 0 , yIdx = 1 , rowIdx = 2 ;
339
+ rows . forEach ( ( arow ) => {
340
+ const x = Number ( arow [ xIdx ] ) ;
341
+ const y = Number ( arow [ yIdx ] ) ;
342
+ if ( x >= xMin && x <= xMax && y >= yMin && y <= yMax ) {
343
+ selectInfoCls . setRowSelect ( Number ( arow [ rowIdx ] ) , true ) ;
344
+ }
345
+ } ) ;
346
+ const selectInfo = selectInfoCls . data ;
347
+ TablesCntlr . dispatchTableSelect ( tblId , selectInfo ) ;
348
+ }
342
349
}
343
350
}
344
351
}
@@ -389,15 +396,19 @@ class ChartsPanel extends React.Component {
389
396
390
397
selectionNotEmpty ( selection ) {
391
398
const rows = get ( this . props , 'tblPlotData.xyPlotData.rows' ) ;
392
- if ( rows && selection ) {
393
- const { xMin, xMax, yMin, yMax} = selection ;
394
- const xIdx = 0 , yIdx = 1 ;
395
- const aPt = rows . find ( ( arow ) => {
396
- const x = Number ( arow [ xIdx ] ) ;
397
- const y = Number ( arow [ yIdx ] ) ;
398
- return ( x >= xMin && x <= xMax && y >= yMin && y <= yMax ) ;
399
- } ) ;
400
- return Boolean ( aPt ) ;
399
+ if ( rows ) {
400
+ if ( selection ) {
401
+ const { xMin, xMax, yMin, yMax} = selection ;
402
+ const xIdx = 0 , yIdx = 1 ;
403
+ const aPt = rows . find ( ( arow ) => {
404
+ const x = Number ( arow [ xIdx ] ) ;
405
+ const y = Number ( arow [ yIdx ] ) ;
406
+ return ( x >= xMin && x <= xMax && y >= yMin && y <= yMax ) ;
407
+ } ) ;
408
+ return Boolean ( aPt ) ;
409
+ } else {
410
+ return true ; // empty selection replacing non-empty
411
+ }
401
412
} else {
402
413
return false ;
403
414
}
@@ -413,7 +424,7 @@ class ChartsPanel extends React.Component {
413
424
src = { ZOOM_IN }
414
425
onClick = { ( ) => this . addZoom ( ) }
415
426
/>
416
- { ! get ( this . props , 'tblPlotData.xyPlotData.decimateKey' ) && < img style = { selectionBtnStyle }
427
+ { < img style = { selectionBtnStyle }
417
428
title = 'Select enclosed points'
418
429
src = { SELECT_ROWS }
419
430
onClick = { ( ) => this . addSelection ( ) }
0 commit comments