Adds no events.
Sends a message when the mouse is within a 30 pixel radius of a dot.
Sends a Nothing when the mouse is not hovering a dot.
Pass a message taking the data of the data point hovered.
eventsConfig : Events.Config Data Msg
eventsConfig =
Events.hoverOne HoverSee the full example here.
Sends a message when the mouse is within a 30 pixel distance of a
x-coordinate with one or several dots on. Sends a [] when the mouse
is not hovering an dots.
Pass a message taking the data of the data points hovered.
eventsConfig : Events.Config Data Msg
eventsConfig =
Events.hoverMany OnHoverManySee the full example here.
Sends a given message when clicking on a dot.
Pass a message taking the data of the data points clicked.
eventsConfig : Events.Config Data Msg
eventsConfig =
Events.click ClickSee the full example here.
Add your own combination of events. The cool thing here is that you can pick
another Events.Decoder or use Events.on for events without shortcuts.
eventsConfig : Events.Config Data Msg
eventsConfig =
Events.custom
[ Events.onMouseMove Hover Events.getNearest
, Events.onMouseLeave (Hover Nothing)
]See the full example here.
This example sends the Hover message with the data of the nearest dot when
hovering the chart area and Hover Nothing when your leave the chart area.
Add any event to your chart.
Arguments:
The JavaScript event name.
The message.
The Events.Decoder to determine what data you want from the event.
Same as on, but you can add some options too!
1. The JavaScript event name.
2. The `Options`.
2. The message.
3. The `Events.Decoder` to determine what data you want from the event.Gets you information about where your event happened on your chart. This example gets you the data of the nearest dot to where you are hovering.
events : Config Data Msg
events =
Events.custom
[ Events.onMouseMove Hover Events.getNearest ]Get the SVG-space coordinates of the event.
Get the data-space coordinates of the event.
Get the data coordinates nearest to the event.
Returns Nothing if you have no data showing.
Get the data coordinates horizontally nearest to the event.
Get the data coordinates nearest of the event within the radius
you provide in the first argument. Returns Nothing if you have no data showing.
Finds the data coordinates horizontally nearest to the event, within the distance you provide in the first argument.
type Msg
= Hover ( Maybe Data, Coordinate.Point )
events : Events.Config Data Msg
events =
Events.custom
[ Events.onMouseMove Hover decoder ]
decoder : Events.Decoder
decoder =
Events.map2 (,) Events.getNearest Events.getSvg
Use in the
LineChart.Configpassed toLineChart.viewCustom.