Methods and Events
22 Feb 20185 minutes to read
Methods
redraw()
This methods redraws the entire sparkline. You can call redraw()
whenever you update, add or remove points from the data source or whenever you want to refresh the UI.
@(Html.EJ().Sparkline("container"))
// redraw method for sparkline
$("#container").ejSparkline("redraw");
Events
Load
The Load
event is fired before loading the sparkline.
@(Html.EJ().Sparkline("container")
.Load("onLoad");
)
<script type="text/javascript">
function onLoad(sender) {
//Do something
}
</script>
Loaded
The Loaded
event is fired after loaded the sparkline.
@(Html.EJ().Sparkline("container")
.Loaded("onLoaded");
)
<script type="text/javascript">
function onLoaded(sender) {
//Do something
}
</script>
TooltipInitialize
Fires before rendering trackball tooltip. You can use TooltipInitialize
event to customize the text displayed in trackball tooltip.
@(Html.EJ().Sparkline("container")
.TooltipInitialize("onTooltipInitialize")
)
<script type="text/javascript">
function onTooltipInitialize(sender) {
//Do something
}
</script>
SeriesRendering
Fires before rendering a series. The SeriesRendering
event is fired for each series in Sparkline.
@(Html.EJ().Sparkline("container")
.SeriesRendering("onSeriesRender")
)
<script type="text/javascript">
function onSeriesRender(sender) {
//Do something
}
</script>
PointRegionMouseMove
The PointRegionMouseMove
event is fired when mouse is moved over a point.
@(Html.EJ().Sparkline("container")
.PointRegionMouseMove("onPointMouseMove")
)
<script type="text/javascript">
function onPointMouseMove(sender) {
//Do something
}
</script>
PointRegionMouseClick
The PointRegionMouseClick
event is fired on clicking a point in sparkline. You can use this event to handle clicks made on points.
@(Html.EJ().Sparkline("container")
.PointRegionMouseClick("onPointMouseClick")
)
<script type="text/javascript">
function onPointMouseClick(sender) {
//Do something
}
</script>
SparklineMouseMove
The SparklineMouseMove
is fired on moving mouse over the sparkline.
@(Html.EJ().Sparkline("container")
.SparklineMouseMove("onSparklineMouseMove")
)
<script type="text/javascript">
function onSparklineMouseMove(sender) {
//Do something
}
</script>
SparklineMouseLeave
The SparklineMouseLeave
event is fired on moving mouse outside the sparkline.
@(Html.EJ().Sparkline("container")
.SparklineMouseLeave("onSparklineMouseLeave")
)
<script type="text/javascript">
function onSparklineMouseLeave(sender) {
//Do something
}
</script>
Click
The Click
event is fired on clicking the sparkline.
@(Html.EJ().Sparkline("container")
.Click("onClick")
)
<script type="text/javascript">
function onClick(sender) {
//Do something
}
</script>
DoubleClick
The DoubleClick
event is fired on double clicking the sparkline.
@(Html.EJ().Sparkline("container")
.DoubleClick("onDoubleClick")
)
<script type="text/javascript">
function onDoubleClick(sender) {
//Do something
}
</script>
RightClick
The RightClick
event is fired on right clicking the sparkline.
@(Html.EJ().Sparkline("container")
.RightClick("onRightClick")
)
<script type="text/javascript">
function onRightClick(sender) {
//Do something
}
</script>