'Blazor.ChartJs Mouse Click Handler not working correctly
I am writing a Blazor app using the ChartJs Blazor (Blazor.ChartJs.Fork 2.0.2) library. I am creating a bar chart with a need to determine on which bar the user is clicking.
To capture the mouse click I have a pointer to the mouse click hander in the Options (new BarOptions) segment, I have the parameter:
OnClick = new DelegateHandler<ChartMouseEvent>(OnClickHandler)
This is the code for the handler.
public static void OnClickHandler(JObject mouseEvent, JArray activeElements)
{
var count = activeElements.Count();
}
I am just putting a break point in this handler to view the parameter values. When running the code, it will only hit the breakpoint when I click on the bar graph where there is no bar, it will not break when I click on a bar.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|