Skip to content

Commit 921c40f

Browse files
committed
Fixed unrecoverable error when chart is added from dropdown while single view multi-chart is expanded.
Also made histogram API backward compatible.
1 parent f922fa6 commit 921c40f

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

src/firefly/js/charts/ChartUtil.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,27 @@ export function makeXYPlotParams(params) {
183183
* @memberof firefly.util.chart
184184
*/
185185
export function makeHistogramParams(params) {
186-
const {col, xOptions, yOptions, falsePositiveRate} = params;
186+
const {col, xOptions, yOptions, falsePositiveRate, binWidth} = params;
187187
let numBins = params.numBins;
188-
if (!falsePositiveRate && !numBins) {numBins = 50;}
188+
let fixedBinSizeSelection = params.fixedBinSizeSelection;
189+
if (!falsePositiveRate) {
190+
if (!fixedBinSizeSelection) {
191+
fixedBinSizeSelection = 'numBins';
192+
}
193+
if (!numBins) {
194+
numBins = 50;
195+
}
196+
}
189197
const algorithm = numBins ? 'fixedSizeBins' : 'bayesianBlocks';
190198

191199
if (col) {
192200
const histogramParams =
193201
{
194202
columnOrExpr: col,
195203
algorithm,
204+
fixedBinSizeSelection,
196205
numBins,
206+
binWidth,
197207
falsePositiveRate,
198208
x: xOptions||'',
199209
y: yOptions||''

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55

66
import React, {PropTypes} from 'react';
7+
import {get} from 'lodash';
78
import {getChartData} from '../ChartsCntlr.js';
89
import {dispatchChangeViewerLayout, dispatchUpdateCustom, getViewerItemIds, getViewer, getLayoutType, getMultiViewRoot} from '../../visualize/MultiViewCntlr.js';
910

@@ -168,7 +169,8 @@ MultiChartToolbarExpanded.propTypes= {
168169
};
169170

170171
const getChartTitle = (chartId, viewerItemIds) => {
171-
const {chartType} = getChartData(chartId);
172+
const chartData = getChartData(chartId);
173+
const chartType = get(chartData, 'chartType');
172174
const idx = viewerItemIds.findIndex((el) => {return el === chartId;} );
173175
if (idx>=0) {
174176
return `${idx+1}-${chartType}`;

src/firefly/js/visualize/iv/ExpandedTools.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55

66
import React, {PropTypes} from 'react';
7-
import {ExpandType, WcsMatchType, dispatchChangeExpandedMode,
8-
dispatchExpandedAutoPlay, dispatchWcsMatch} from '../ImagePlotCntlr.js';
7+
import {ExpandType, dispatchChangeExpandedMode,
8+
dispatchExpandedAutoPlay} from '../ImagePlotCntlr.js';
99
import {primePlot} from '../PlotViewUtil.js';
1010
import {ToolbarButton} from '../../ui/ToolbarButton.jsx';
1111
import {PlotTitle, TitleType} from './PlotTitle.jsx';
@@ -211,11 +211,11 @@ export function PagingControl({viewerItemIds,activeItemId,isPagingMode,getItemTi
211211
if (!activeItemId || viewerItemIds.length<2 || !isPagingMode) return <div style={controlStyle}/>;
212212

213213
const cIdx= viewerItemIds.indexOf(activeItemId);
214+
if (cIdx<0) return <div style={controlStyle}/>;
215+
214216
const nextIdx= cIdx===viewerItemIds.length-1 ? 0 : cIdx+1;
215217
const prevIdx= cIdx ? cIdx-1 : viewerItemIds.length-1;
216218

217-
218-
219219
const dots= viewerItemIds.map( (plotId,idx) =>
220220
idx===cIdx ?
221221
<img src={ACTIVE_DOT} className='control-dots'

0 commit comments

Comments
 (0)