Available in the Full Version

Sparkline - Bind to Remote Data

This sample is designed for a larger screen size.

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

In this example, the igSparkline is bound to data from a remote service. The service returns a JSON-serialized list of invoices for the igSparkline to render.

Code View

Copy to Clipboard
<!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>

	<table>
		<tr>
			<td  style="width: 330px;">
				<!-- Target element for the igSparkline -->
				<div id="sparkline"></div>
			</td>
		</tr>
	</table>
    
    <!-- File supplying the northwindInvoices object for the igSparkline data source -->
    <script src="/data-files/nw-invoices.js"></script>

    <script>

        $(function () {

            $("#sparkline").igSparkline({
                dataSource: "https://www.igniteui.com/api/invoices?callback=?",
                responseDataKey: "d.results",
                height: "100px",
                width: "100%",
                valueMemberPath: 'ExtendedPrice'
            });

        });
    </script>       

</body>
</html>