Skip to content

Commit 7fb7394

Browse files
authored
DM-7965 - merged pr #258: consistent highlight and select colors; fixed histogram tooltip.
DM-7965 make consistent highlight and selection colors Also fixed histogram tooltip causing TypeError.
2 parents 576cada + 8f040c8 commit 7fb7394

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import React, {PropTypes} from 'react';
66
import ReactHighcharts from 'react-highcharts';
77
import numeral from 'numeral';
8-
import {set} from 'lodash';
8+
import {get, set} from 'lodash';
99
import {getFormatString} from '../../util/MathUtil.js';
1010
import {logError} from '../../util/WebUtil.js';
1111

@@ -368,14 +368,26 @@ export class Histogram extends React.Component {
368368
text: ''
369369
},
370370
tooltip: {
371-
split: true,
371+
//shared: true works, split: true does not work with the current formatter in Highcharts 5
372372
followPointer: true,
373373
borderWidth: 1,
374374
formatter() {
375375
if (this.y === minY) {return false;} // don't display tooltip
376-
return '<span>'+(this.point.name ? `<b>Bin center:</b> ${this.point.name}<br/>` : '')+
377-
(this.point.range ? `<b>Range:</b> ${this.point.range}<br/>` : '')+
376+
let name, range;
377+
// either a point or an array of points are passed depending if the tooltip is shared
378+
if (this.point) {
379+
name = this.point.name;
380+
range = this.point.range;
381+
} else {
382+
const point = get(this, 'points[0].point');
383+
if (!point) {return false;}
384+
name = point.name;
385+
range = point.range;
386+
}
387+
return '<span>' + (name ? `<b>Bin center:</b> ${name}<br/>` : '') +
388+
(range ? `<b>Range:</b> ${range}<br/>` : '') +
378389
`<b>Count:</b> ${this.y}</span>`;
390+
379391
}
380392
},
381393
plotOptions: {

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
33
*/
4-
import {isUndefined, debounce, get, omit} from 'lodash';
4+
import {isUndefined, debounce, get, has, omit} from 'lodash';
55
import shallowequal from 'shallowequal';
66
import React, {PropTypes} from 'react';
77
import ReactHighcharts from 'react-highcharts';
@@ -66,12 +66,12 @@ const MINMAX = 'minmax';
6666

6767
const datapointsColor = 'rgba(63, 127, 191, 0.5)';
6868
const datapointsColorWithErrors = 'rgba(63, 127, 191, 0.7)';
69-
const errorBarColor = 'rgba(191, 192, 193, 0.5)';
70-
const selectedColorWithErrors = 'rgba(21, 138, 15, 0.7)';
71-
const selectedColor = 'rgba(21, 138, 15, 0.5)';
72-
const highlightedColor = 'rgba(250, 243, 40, 1)';
73-
const selectionRectColor = 'rgba(165, 165, 165, 0.5)';
74-
69+
const errorBarColor = 'rgba(255, 209, 128, 0.5)';
70+
const selectedColorWithErrors = 'rgba(255, 200, 0, 1)';
71+
const selectedColor = 'rgba(255, 200, 0, 1)';
72+
const highlightedColor = 'rgba(255, 165, 0, 1)';
73+
const selectionRectColor = 'rgba(255, 209, 128, 0.5)';
74+
const selectionRectColorGray = 'rgba(165, 165, 165, 0.5)';
7575

7676
/*
7777
@param {number} weight for a given point
@@ -470,9 +470,10 @@ export class XYPlot extends React.Component {
470470
const yMaxPx = chart.yAxis[0].toPixels(selection.yMax);
471471
const width = Math.abs(xMaxPx - xMinPx);
472472
const height = Math.abs(yMaxPx - yMinPx);
473+
const selColor = has(this.props, 'data.decimateKey') ? selectionRectColor : selectionRectColorGray;
473474
this.selectionRect = chart.renderer.rect(Math.min(xMinPx, xMaxPx), Math.min(yMinPx, yMaxPx), width, height, 1)
474475
.attr({
475-
fill: selectionRectColor,
476+
fill: selColor,
476477
stroke: '#8c8c8c',
477478
'stroke-width': 0.5,
478479
zIndex: 7 // same as Highcharts' selectionMrker rectangle
@@ -640,7 +641,7 @@ export class XYPlot extends React.Component {
640641
id: HIGHLIGHTED,
641642
name: HIGHLIGHTED,
642643
color: highlightedColor,
643-
marker: {symbol: 'circle', lineColor: '#404040', lineWidth: 1, radius: 4},
644+
marker: {symbol: 'circle', radius: 4, lineColor: '#737373', lineWidth: 1},
644645
data: highlightedData,
645646
showInLegend: false
646647
}, true, false);
@@ -725,7 +726,7 @@ export class XYPlot extends React.Component {
725726
display: 'none'
726727
}
727728
},
728-
selectionMarkerFill: selectionRectColor
729+
selectionMarkerFill: decimateKey? selectionRectColor : selectionRectColorGray
729730
},
730731
exporting: {
731732
enabled: true

src/firefly/js/tables/ui/TablePanel.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,6 @@ body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main, .fixedDataTableColu
547547
}
548548

549549
.fixedDataTableRowLayout_rowWrapper .tablePanel__Row_highlighted {
550-
background-color: #d3fad1
550+
background-color: #ffe8bf /* #d3fad1 */
551551
}
552552

src/firefly/js/visualize/draw/DrawingDef.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Enum from 'enum';
77

88

99
export const COLOR_SELECTED_PT = '#ffff00';
10-
export const COLOR_HIGHLIGHTED_PT = '#00aaff';
10+
export const COLOR_HIGHLIGHTED_PT = '#ff8000'; // orange
1111
export const COLOR_PT_1 = '#ff0000'; // red
1212
export const COLOR_PT_2 = '#00ff00'; //green
1313
export const COLOR_PT_3 = 'pink'; // pink

0 commit comments

Comments
 (0)