From 9fc748e6b09783f6bb375a68d10040141ac502f2 Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Wed, 2 Aug 2023 15:02:26 -0400
Subject: last

---
 src/client/views/nodes/DataVizBox/components/PieChart.tsx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'src/client/views/nodes/DataVizBox/components/PieChart.tsx')

diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
index 98c79f95a..d3d16aa4c 100644
--- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
@@ -43,6 +43,7 @@ export class PieChart extends React.Component<PieChartProps> {
     private byCategory: boolean = true; // whether the data is organized by category or by specified number percentages/ratios
     @observable _currSelected: any | undefined = undefined;
     private curSliceSelected: any = undefined;
+    private selectedTry: any = undefined;
     // TODO: nda - some sort of mapping that keeps track of the annotated points so we can easily remove when annotations list updates
 
     @computed get _piechartData() {
@@ -328,6 +329,7 @@ export class PieChart extends React.Component<PieChartProps> {
                         : 
                         this._currSelected===showSelected;
                     this._currSelected = sameAsCurrent? undefined: showSelected;
+                    this.selectedTry = sameAsCurrent? undefined: d;
                     return true;
                 }
                 return false;
@@ -343,6 +345,7 @@ export class PieChart extends React.Component<PieChartProps> {
             }
         });
 
+        var selected = this.selectedTry;
         var arcs = g.selectAll("arc")
             .data(pie(data))
             .enter()
@@ -363,7 +366,10 @@ export class PieChart extends React.Component<PieChartProps> {
                 }
                 var accessByName = descriptionField? dataPoint[descriptionField] : dataPoint[percentField];
                 return this.props.layoutDoc['pieSliceColors-'+accessByName]? StrCast(this.props.layoutDoc['pieSliceColors-'+accessByName]) : d3.schemeSet3[i]? d3.schemeSet3[i]: d3.schemeSet3[i%12] })
-            .attr("class", 'slice')
+                .attr("class", selected? 
+                function(d) {
+                    return (selected && d.startAngle==selected.startAngle && d.endAngle==selected.endAngle)? 'slice hover' : 'slice';
+                }: function(d) {return 'slice'})
             .attr("d", arc)
             .on('click', onPointClick)
 
-- 
cgit v1.2.3-70-g09d2

