add percentage

This commit is contained in:
Pritimay Sarkar
2023-07-31 18:33:02 +05:30
parent ba7c8e9d2f
commit 3932f197e0
3 changed files with 13 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ class AbsorbanceGraph extends Component {
super(props);
this.state = { url: this.props.url, show: this.props.show };
}
componentDidMount() {
this.drawChart(this.state.url);
}

View File

@@ -1,7 +1,17 @@
.container {
display: flex;
flex-direction: row;
flex-direction: column;
align-items: center;
justify-content: center;
height: 50vh;
}
@media screen and (min-width: 900px) {
.container {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
height: 50vh;
}
}

View File

@@ -65,7 +65,7 @@ class TestAnalyticsPie extends Component {
.attr("d", path)
.attr("fill", function (d) { return color(d.data.category); })
.on('mouseover', (event, d) => {
tooltip.text(`${d.data.category}: ${d.data.count}`);
tooltip.text(`${d.data.category}: ${d.data.count}, ${100 * d.data.count/data.reduce((a, c) => a + c.count, 0)}%`);
return tooltip
.style("visibility", "visible")
.style("font-size", "0.75em")