swimlane / ngx-charts

:bar_chart: Declarative Charting Framework for Angular
https://swimlane.github.io/ngx-charts/
MIT License
4.28k stars 1.15k forks source link

[ngx-charts-pie-chart] shows wrong tootltip position in view #604

Open divyanshusrivastava02 opened 6 years ago

divyanshusrivastava02 commented 6 years ago

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior [ngx-charts-pie-chart] shows wrong tootltip position in view

Expected behavior Must be next to mouse or should be on highlighted element.

Reproduction of the problem I used demo link where I re-tested this issue like GO TO > https://swimlane.gitbooks.io/ngx-charts/content/charts/pie-chart.html

CHANGE VALUES "app.ts" template value to:-

<ngx-charts-pie-chart [view]="view" [scheme]="colorScheme" [results]="single" [legend]="false" [explodeSlices]="explodeSlices" [labels]="false" [doughnut]="true" [gradient]="true" [arcWidth]=[0.40] (select)="onSelect($event)">

CHANGE "data.ts" single array value to:- export var single = [ { "name": "Germany", "value": 20 }, { "name": "USA", "value": 40 }, { "name": "France", "value": 40 } ];

ngxissue2

My mouse position is on RED

marjan-georgiev commented 6 years ago

The reason it is positioned there is because the tooltip is positioned on top of the bounding rectangle of the SVG element, and in this case, that looks like this:

image

It is not ideal. Perhaps we can position it at the center of the element instead of the top, but that requires modifying the tooltip component.

arsyed04 commented 6 years ago

This somehow seems fine in demo at https://swimlane.github.io/ngx-charts/#/ngx-charts/bar-horizontal

chunhui2001 commented 6 years ago

Tooltip content position wrong if I include foundation-flex-6.3.0.min.css style framework.

wechatimg22

How can I override Tooltip position if I used foundation-flex-6.3.0.min.css style framework.

vijaychhajer commented 6 years ago

Any updates on this please. Are we going to have any fix for this.

Allexik commented 6 months ago

+1, would be nice to have it following cursor or at least somewhere in / on the item. Or you may give a function input which would be called on hover with the element hovered and the hover event as the parameters which would return the tooltip position.