From 5a1bf41682f641967304c8a7fa7df9b6b343b7b2 Mon Sep 17 00:00:00 2001 From: srichman333 Date: Thu, 10 Aug 2023 13:21:10 -0400 Subject: changing selected slice/bar color w different data types bug fix --- src/client/views/nodes/DataVizBox/components/Histogram.tsx | 8 +++++++- src/client/views/nodes/DataVizBox/components/PieChart.tsx | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') 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 { .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)}) }; diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx index de725209d..03c9efdd1 100644 --- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx +++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx @@ -266,7 +266,7 @@ export class PieChart extends React.Component { } var sliceColor; if (dataPoint){ - var accessByName = descriptionField? dataPoint[descriptionField] : dataPoint[percentField]; + var accessByName = dataPoint[this.props.axes[0]].replace(/\$/g, '').replace(/\%/g, '').replace(/\ each.split('::')); sliceColors.map(each => {if (each[0]==StrCast(accessByName)) sliceColor = each[1]}); } -- cgit v1.2.3-70-g09d2