Available in the Full Version

Sparkline - Collection Binding

This example demonstrates rendering the igSparkline using the ASP.NET MVC helper.

This sample is designed for a larger screen size.

On mobile, try rotating your screen, view full size, or email to another device.

The helper binds to a collection of objects on the server, serializes the collection to JSON objects, and renders the required igSparkline HTML and JavaScript.

Code View

Copy to Clipboard
@using Infragistics.Web.Mvc
@model IQueryable<IgniteUI.SamplesBrowser.Models.Northwind.Invoice>

<!DOCTYPE html>

<html>
<head>
    <title></title>

    <!-- Ignite UI for jQuery Required Combined CSS Files -->
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/structure/infragistics.css" rel="stylesheet" />

    <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script>
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>

    <!-- Ignite UI for jQuery Required Combined JavaScript Files -->
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.core.js"></script>
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.dv.js"></script>

</head>
<body>
    @(Html.Infragistics().Sparkline<IgniteUI.SamplesBrowser.Models.Northwind.Invoice>(Model)
        .ID("sparkline")
        .Height("100px")
        .Width("100%")
        .ValueMemberPath("ExtendedPrice")
        .DataBind()
        .Render()    
    )
 
</body>
</html>