aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/components/PieChart.tsx
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2023-07-26 16:27:12 -0400
committersrichman333 <sarah_n_richman@brown.edu>2023-07-26 16:27:12 -0400
commit3a177316c1f104da538ed4a53c6a442c6f3fcdc4 (patch)
tree961b95ecadd466ff8f17b38b002ac24d713aa113 /src/client/views/nodes/DataVizBox/components/PieChart.tsx
parent27bf26fe688baabff93ab6ebb6b75af4043d29d3 (diff)
histogram reorganized to accommodate more data types
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/PieChart.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/components/PieChart.tsx13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
index 37c435411..fc24e5821 100644
--- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
@@ -182,7 +182,7 @@ export class PieChart extends React.Component<PieChartProps> {
getAnchor = (pinProps?: PinProps) => {
const anchor = Docs.Create.ConfigDocument({
//
- title: 'line doc selection' + this._currSelected?.x,
+ title: 'piechart doc selection' + this._currSelected?.x,
});
PresBox.pinDocView(anchor, { pinDocLayout: pinProps?.pinDocLayout, pinData: pinProps?.pinData }, this.props.dataDoc);
anchor.presDataVizSelection = this._currSelected ? new List<number>([this._currSelected.x, this._currSelected.y]) : undefined;
@@ -260,12 +260,6 @@ export class PieChart extends React.Component<PieChartProps> {
})
return valid;
});
-
- var pie = d3.pie();
- var arc = d3.arc()
- .innerRadius(0)
- .outerRadius(radius);
-
if (this.byCategory){
let uniqueCategories = [...new Set(data)]
var pieStringDataSet: { frequency: any, label: any }[] = [];
@@ -282,6 +276,11 @@ export class PieChart extends React.Component<PieChartProps> {
var trackDuplicates : {[key: string]: any} = {};
data.forEach((eachData: any) => !trackDuplicates[eachData]? trackDuplicates[eachData] = 0: null)
+ var pie = d3.pie();
+ var arc = d3.arc()
+ .innerRadius(0)
+ .outerRadius(radius);
+
const onPointClick = action((e: any) => {
// check the 4 'corners' of each slice and see if the pointer is within those bounds to get the slice the user clicked on
const pointer = d3.pointer(e);