Skip to content

Commit ba416a2

Browse files
committed
DM-10833 multi-trace charts as the default charts in triview
2 parents d54d2a2 + b1b8a14 commit ba416a2

35 files changed

+676
-209
lines changed

src/firefly/html/demo/ffapi-highlevel-charttest.html

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ <h2>
3333
<br/><br/>
3434
<div id="plotlyDiv" style="resize: both; overflow: auto; padding: 5px; width: 800px; height: 550px; border: solid 1px gray;"></div>
3535
<br/><br/>
36+
<h3>Default chart for 'allwise' table group below</h3>
37+
<div id="defaultChart" style="resize: both; overflow: auto; padding: 5px; width: 800px; height: 550px; border: solid 1px gray;"></div>
38+
<br/><br/>
3639
<div id="table-1" style="width: 800px; height: 550px; border: solid 1px;"></div>
3740
<br/><br/>
3841

3942
<script type="text/javascript">
4043
if (!window.firefly) window.firefly= {};
41-
window.firefly.options= {charts: {chartEngine: 'plotly'}};
44+
window.firefly.options= {charts: {chartEngine: 'plotly', chartEngine: 'plotly'}};
4245
</script>
4346

4447
<script type="text/javascript">
@@ -157,17 +160,28 @@ <h2>
157160
firefly.showChart('plotlyDiv', {data: data});
158161

159162

160-
var tblReq = firefly.util.table.makeIrsaCatalogRequest('allwise_p3as_psd', 'WISE', 'allwise_p3as_psd',
163+
var tblReq = firefly.util.table.makeIrsaCatalogRequest('allwise-500', 'WISE', 'allwise_p3as_psd',
161164
{ position: '10.68479;41.26906;EQ_J2000',
162165
SearchMethod: 'Cone',
163166
radius: 300
164167
},
165-
// { position: '202.48;47.23;EQ_J2000',
166-
// SearchMethod: 'Cone',
167-
// radius: 30,
168-
// },
169-
{tbl_id: 'test-tbl'});
170-
firefly.showTable('table-1', tblReq);
168+
{ tbl_id: 'test-tbl',
169+
META_INFO: {defaultChartDef: JSON.stringify({data: [{x: 'tables::w1mpro', y: 'tables::w2mpro', mode: 'markers'}]})}
170+
});
171+
var tblReqSm = firefly.util.table.makeIrsaCatalogRequest('allwise-10', 'WISE', 'allwise_p3as_psd',
172+
{ position: '202.48;47.23;EQ_J2000',
173+
SearchMethod: 'Cone',
174+
radius: 30
175+
},
176+
{ tbl_id: 'test-tbl-sm',
177+
META_INFO: {defaultChartDef: JSON.stringify({data: [{x: 'tables::w3mpro', y: 'tables::w4mpro', mode: 'markers'}]})}
178+
});
179+
180+
181+
firefly.showTable('table-1', tblReq, {tbl_group: 'allwise'});
182+
firefly.showTable('table-1', tblReqSm, {tbl_group: 'allwise'});
183+
184+
firefly.showChart('defaultChart', {tbl_group: 'allwise'});
171185

172186
// using column expressions
173187
var tblReqXpr = Object.assign({}, tblReq, {inclCols: 'ra + dec as radec, ra, dec, ln(dec) as LnOfDec, power(ra, 2) as ra_sq'});

src/firefly/html/firefly.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
options : {
2323
MenuItemKeys: {maskOverlay:true},
2424
catalogSpacialOp: 'polygonWhenPlotExist',
25-
charts: {chartEngine: 'plotly'}
25+
charts: {chartEngine: 'plotly', multitrace: true}
2626
}
2727
}
2828
};
Loading

src/firefly/js/api/ApiHighlevelBuild.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,26 @@ function doShowChart(llApi, targetDiv, params={}) {
406406
const {dispatchChartAdd}= llApi.action;
407407
const {uniqueChartId} = llApi.util.chart;
408408
const {renderDOM} = llApi.util;
409-
const {MultiChartViewer}= llApi.ui;
409+
const {ChartsContainer}= llApi.ui;
410410

411-
params = Object.assign({chartId: uniqueChartId(`${targetDiv}`), viewerId: targetDiv, chartType: 'plot.ly'}, params);
412-
dispatchChartAdd(params);
411+
const tbl_group = params.tbl_group;
412+
// when tbl_group parameter is set, show a default chart
413+
// for an active table in this table group
414+
if (!tbl_group) {
415+
params = Object.assign({
416+
chartId: uniqueChartId(`${targetDiv}`),
417+
viewerId: targetDiv,
418+
chartType: 'plot.ly'
419+
}, params);
420+
dispatchChartAdd(params);
421+
}
413422

414-
renderDOM(targetDiv, MultiChartViewer,
423+
renderDOM(targetDiv, ChartsContainer,
415424
{
416425
key: `${targetDiv}-plot`,
417426
viewerId: targetDiv,
427+
tbl_group,
428+
addDefaultChart: Boolean(tbl_group),
418429
closeable: false,
419430
expandedMode: false
420431
}

src/firefly/js/api/ApiViewer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {getConnectionCount, WS_CONN_UPDATED, GRAB_WINDOW_FOCUS} from '../core/Ap
3131
import {dispatchAddCell, dispatchEnableSpecialViewer, LO_VIEW} from '../core/LayoutCntlr.js';
3232
import {dispatchAddSaga} from '../core/MasterSaga.js';
3333
import {modifyURLToFull} from '../util/BrowserUtil.js';
34-
import {DEFAULT_FITS_VIEWER_ID} from '../visualize/MultiViewCntlr.js';
34+
import {DEFAULT_FITS_VIEWER_ID, DEFAULT_PLOT2D_VIEWER_ID} from '../visualize/MultiViewCntlr.js';
3535
import {REINIT_APP} from '../core/AppDataCntlr.js';
3636

3737

@@ -362,7 +362,7 @@ function plotRemoteChart(params, viewerId, dispatch) {
362362

363363
const dispatchParams= clone({
364364
groupId: viewerId || 'default',
365-
viewerId:viewerId || 'default',
365+
viewerId:viewerId || DEFAULT_PLOT2D_VIEWER_ID,
366366
chartId: params.chartId || uniqueChartId(),
367367
chartType: 'plot.ly',
368368
closeable: true,
@@ -401,7 +401,7 @@ function plotRemoteXYPlot(params, viewerId, dispatch) {
401401
// SCATTER
402402
dispatchChartAdd({chartId, chartType: SCATTER,
403403
groupId: viewerId || 'default',
404-
viewerId:viewerId || 'default',
404+
viewerId:viewerId || DEFAULT_PLOT2D_VIEWER_ID,
405405
chartDataElements: [
406406
{
407407
type: DT_XYCOLS,
@@ -441,7 +441,7 @@ function plotRemoteHistogram(params, viewerId, dispatch) {
441441
dispatchChartAdd({chartId,
442442
chartType: HISTOGRAM,
443443
groupId: viewerId || 'default',
444-
viewerId:viewerId || 'default',
444+
viewerId:viewerId || DEFAULT_PLOT2D_VIEWER_ID,
445445
chartDataElements: [
446446
{
447447
type: DT_HISTOGRAM,

0 commit comments

Comments
 (0)