File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11@inject IJSRuntime JSRuntime
22
33<div id =" @(" chartcontainer " + Config.CanvasId)" class =" chart-container @Class"
4- style =" height :@Height; width :@Width; @(Style )" >
4+ style =" height :@Height; width :@Width; @(Style )" @onmouseout = " async (args) => await OnMouseOut(args) " >
55 <canvas id =" @Config.CanvasId" style =" @(Height != null ? $ " height:{Height} " : " " ) @(Width != null ? $" width:{Width}; " : " " )" ></canvas >
66</div >
Original file line number Diff line number Diff line change 22using Microsoft . AspNetCore . Components ;
33using Microsoft . JSInterop ;
44using System . Threading . Tasks ;
5+ using Microsoft . AspNetCore . Components . Web ;
56
67namespace PSC . Blazor . Components . Chartjs
78{
@@ -105,6 +106,14 @@ public void Dispose()
105106 this . oldReference ? . Dispose ( ) ;
106107 }
107108
109+ private ValueTask OnMouseOut ( MouseEventArgs mouseEventArgs )
110+ {
111+ if ( Config . Options is Options { OnMouseOutAsync : { } } options )
112+ return options . OnMouseOutAsync ( mouseEventArgs ) ;
113+ else
114+ return ValueTask . CompletedTask ;
115+ }
116+
108117 #region JavaScript invokable functions
109118
110119 [ JSInvokable ]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- using System . Threading . Tasks ;
1+ using Microsoft . AspNetCore . Components . Web ;
2+ using System . Threading . Tasks ;
23
34namespace PSC . Blazor . Components . Chartjs . Models . Common
45{
@@ -7,6 +8,28 @@ namespace PSC.Blazor.Components.Chartjs.Models.Common
78 /// </summary>
89 public class Options : IOptions
910 {
11+ #region Events
12+
13+ /// <summary>
14+ /// Gets or sets the on hover asynchronous.
15+ /// </summary>
16+ /// <value>
17+ /// The on hover asynchronous.
18+ /// </value>
19+ [ JsonIgnore ]
20+ public Func < HoverContext , ValueTask > ? OnHoverAsync { get ; set ; }
21+
22+ /// <summary>
23+ /// Gets or sets the on mouse out asynchronous.
24+ /// </summary>
25+ /// <value>
26+ /// The on mouse out asynchronous.
27+ /// </value>
28+ [ JsonIgnore ]
29+ public Func < MouseEventArgs , ValueTask > ? OnMouseOutAsync { get ; set ; }
30+
31+ #endregion Events
32+
1033 /// <summary>
1134 /// Gets or sets the elements.
1235 /// </summary>
@@ -55,15 +78,6 @@ public class Options : IOptions
5578 [ JsonPropertyName ( "maintainAspectRatio" ) ]
5679 public bool MaintainAspectRatio { get ; set ; } = false ;
5780
58- /// <summary>
59- /// Gets or sets the on hover asynchronous.
60- /// </summary>
61- /// <value>
62- /// The on hover asynchronous.
63- /// </value>
64- [ JsonIgnore ]
65- public Func < HoverContext , ValueTask > ? OnHoverAsync { get ; set ; }
66-
6781 /// <summary>
6882 /// Gets or sets the plugins.
6983 /// </summary>
You can’t perform that action at this time.
0 commit comments