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.

  • CSHTML
  • @(Html.EJ().Sparkline("container"))
  • JS
  • // redraw method for sparkline
    $("#container").ejSparkline("redraw");

    Events

    Load

    The Load event is fired before loading the sparkline.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
        .Load("onLoad");
    
    )
  • JS
  • <script type="text/javascript">
        function onLoad(sender) {
                    //Do something
        }
    </script>

    Loaded

    The Loaded event is fired after loaded the sparkline.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
        .Loaded("onLoaded");
    
    )
  • JS
  • <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.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
        .TooltipInitialize("onTooltipInitialize")
    
    )
  • JS
  • <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.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
        .SeriesRendering("onSeriesRender")
    
    )
  • JS
  • <script type="text/javascript">
        function onSeriesRender(sender) {
                    //Do something
        }
    </script>

    PointRegionMouseMove

    The PointRegionMouseMove event is fired when mouse is moved over a point.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
        .PointRegionMouseMove("onPointMouseMove")
    
    )
  • JS
  • <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.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
        .PointRegionMouseClick("onPointMouseClick")
    
    )
  • JS
  • <script type="text/javascript">
        function onPointMouseClick(sender) {
                    //Do something
        }
    </script>

    SparklineMouseMove

    The SparklineMouseMove is fired on moving mouse over the sparkline.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
        .SparklineMouseMove("onSparklineMouseMove")
    
    )
  • JS
  • <script type="text/javascript">
        function onSparklineMouseMove(sender) {
                    //Do something
        }
    </script>

    SparklineMouseLeave

    The SparklineMouseLeave event is fired on moving mouse outside the sparkline.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
        .SparklineMouseLeave("onSparklineMouseLeave")
    
    )
  • JS
  • <script type="text/javascript">
        function onSparklineMouseLeave(sender) {
                    //Do something
        }
    </script>

    Click

    The Click event is fired on clicking the sparkline.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
    .Click("onClick")
    
    )
  • JS
  • <script type="text/javascript">
        function onClick(sender) {
                    //Do something
        }
    </script>

    DoubleClick

    The DoubleClick event is fired on double clicking the sparkline.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
    .DoubleClick("onDoubleClick")
    
    )
  • JS
  • <script type="text/javascript">
        function onDoubleClick(sender) {
                    //Do something
        }
    </script>

    RightClick

    The RightClick event is fired on right clicking the sparkline.

  • CSHTML
  • @(Html.EJ().Sparkline("container")
    
    .RightClick("onRightClick")
    
    )
  • JS
  • <script type="text/javascript">
        function onRightClick(sender) {
                    //Do something
        }
    </script>