Open DonaldAlan opened 6 years ago
Hi @DonaldAlan I need also to show the tooltip when a user clicks the point on a heat map. Did you find the solution?
@BearandYoon
I found a hacky solution that works for bar charts. I track both mouse moves (by adding (mouseMove)="onMouseMove($event)"
to ngx-charts-bar-vertical
) and selects (by adding (select)="onSelect($event)"
). I save the x and y mouse positions from the mouse moves. The event from the select has properties name
and value
from the chart. If there's a menu associated with a particular bar, I render a menu (via the clarity angular package) at the x and y position. It's protected by an *ngIf
that checks if there was a click and if there is a menu item. The div
inside the *ngIf
uses fixed css positioning to make the menu appear at the correct spot.
Maybe this is no more painful than lots of angular programming. Front-end programming is damn hard.
can you please demonstrate an example
I'm submitting a ... (check one with "x")
I want to associate a drop-down menu with each item in a chart so that when the user clicks on a bar (or pie slice or bubble or line....) a pop-up menu appears. The menu that appears should be able to depend on the item associated with the bar (or pie slice, etc).
Custom tooltips exist (https://github.com/swimlane/ngx-charts/pull/399) but they don't do what I want.