-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat[pie/donut]: custom tooltips for aggregate #305
base: master
Are you sure you want to change the base?
Conversation
feat[pie/donut]: custom tooltips for aggregate
Any news on this @scmmishra, would you like me to edit something? |
Hey @riccardogioratoatoms so sorry for the delay. I've been very busy lately with a few stuffs, I'll definitely review this tomorrow. On the surface it looks good to go, there won't be any changes required it seems. I'll update the documentation for it as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could extend the same to percentage chart as well
@@ -119,7 +122,11 @@ export default class PieChart extends AggregationChart { | |||
let title = (this.formatted_labels && this.formatted_labels.length > 0 | |||
? this.formatted_labels[i] : this.state.labels[i]) + ': '; | |||
let percent = (this.state.sliceTotals[i] * 100 / this.state.grandTotal).toFixed(1); | |||
this.tip.setValues(x, y, {name: title, value: percent + "%"}); | |||
let valueTooltip = percent + "%"; | |||
if(this.config.formatTooltip){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not reuse the formatTooltipX and formatTooltipY?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to confuse this single type of values of aggregate charts with the charts legend X and Y cause in aggregate the concept of X and Y is not present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatTooltip
itself is very generic, can we name it better? formatAggrTooltip
is something that I can think of now, do you have any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beyond this, the feature works like a breeze, we're good to merge it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice, this is not available for percentage chart, let's extend it to that too.
Explanation About What Code Achieves:
This code fixes the issue I had with tooltips with pie charts and donuts charts, like I mentioned it here: #304
Considering the fact that these kind of graph have only 1 value I choose the naming of the function as tooltipOptions.formatTooltip without X or Y like it's possible to do with other kind of graphs.
Screenshots/GIFs:
TODOs:
Solves: #136