aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/components/Histogram.tsx
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2023-08-10 13:21:10 -0400
committersrichman333 <sarah_n_richman@brown.edu>2023-08-10 13:21:10 -0400
commit5a1bf41682f641967304c8a7fa7df9b6b343b7b2 (patch)
treec19497bc2b68e447245b36e7b5ce98c72115607b /src/client/views/nodes/DataVizBox/components/Histogram.tsx
parenta89ba9afe33d973c50c0a66aec73db1e22367913 (diff)
changing selected slice/bar color w different data types bug fix
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/Histogram.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/components/Histogram.tsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/Histogram.tsx b/src/client/views/nodes/DataVizBox/components/Histogram.tsx
index 883cc006b..8161a12c9 100644
--- a/src/client/views/nodes/DataVizBox/components/Histogram.tsx
+++ b/src/client/views/nodes/DataVizBox/components/Histogram.tsx
@@ -376,7 +376,13 @@ export class Histogram extends React.Component<HistogramProps> {
.attr("fill", (d)=>{
var barColor;
var barColors = StrListCast(this.props.layoutDoc.histogramBarColors).map(each => each.split('::'));
- barColors.map(each => {if (each[0]==StrCast(d[0])) barColor = each[1]});
+ barColors.map(each => {
+ if (d[0] && d[0].toString() && each[0]==d[0].toString()) barColor = each[1];
+ else {
+ var range = StrCast(each[0]).split(" to ");
+ if (Number(range[0])<=d[0] && d[0]<=Number(range[1])) barColor = each[1];
+ }
+ });
return barColor? StrCast(barColor) : StrCast(this.props.layoutDoc.defaultHistogramColor)})
};