Available in the Full Version

Data Chart - Charts - Financial Indicators

This sample shows the variety of financial indicators that are supported by the chart control. Financial indicators are exposed as separate chart series types and they complement the financial chart series. Financial indicators provide additional information about stocks prices and trends.

This sample is designed for a larger screen size.

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

Code View

Copy to Clipboard
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Financial Indicators</title>

    <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 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" />
    
    <!--CSS file specific for chart styling -->
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/structure/modules/infragistics.ui.chart.css" rel="stylesheet" />

    <!-- 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.lob.js"></script>
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.dv.js"></script>

</head>
<body>
    <script type="text/javascript" src="/data-files/financial-indicators.js"></script>
    <script type="text/javascript" src="/data-files/financial-data.js"></script>

    <script type="text/javascript">

        $(function () {
            $("#priceChart").igDataChart({
                width: "450px",
                height: "400px",
                dataSource: data,
                title: "Microsoft Stock (MSFT)",
                subtitle: "Data over two months",
                axes: [{
                    type: "categoryX",
                    label: "Date",
                    name: "xAxis",
                    interval: 10,
                    title: "Date"
                }, {
                    type: "numericY",
                    name: "yAxis",
                    title: "Price"
                }],
                series: [{
                    type: "financial",
                    isTransitionInEnabled: true,
                    closeMemberPath: "Close",
                    highMemberPath: "High",
                    lowMemberPath: "Low",
                    openMemberPath: "Open",
                    volumeMemberPath: "Volume",
                    xAxis: "xAxis",
                    yAxis: "yAxis",
                    name: "priceSeries",
                    title: "Price Data"
                }]
            });

            $("#indicatorChart").igDataChart({
                width: "450px",
                height: "400px",
                dataSource: data,
                title: "Financial Chart",
                axes: [{
                    type: "categoryX",
                    label: "Date",
                    name: "xAxis",
                    interval: 10,
                    title: "Date"
                }, {
                    type: "numericY",
                    name: "yAxis",
                    title: "Price"
                }],
                series: [{
                    type: "moneyFlowIndexIndicator",
                    isTransitionInEnabled: true,
                    closeMemberPath: "Close",
                    highMemberPath: "High",
                    lowMemberPath: "Low",
                    openMemberPath: "Open",
                    volumeMemberPath: "Volume",
                    xAxis: "xAxis",
                    yAxis: "yAxis",
                    name: "indicatorSeries",
                    title: "Financial Indicator Data"
                }]
            });

            $.each(indicators, function (index, item) {
                $('#indicatorTypes').append($('<option></option>').val(item.key).html(item.text));
            });

            $("#indicatorTypes").change(function () {
                changeIndicator($(this).val());
            });

        });

        function changeIndicator(newIndicator) {
            $("#indicatorChart").igDataChart("option", "series", [{
                name: "indicatorSeries",
                remove: true
            }]);

            $("#indicatorChart").igDataChart("option", "series", [{
                type: newIndicator,
                name: "indicatorSeries",
                title: "Financial Indicator Data",
                xAxis: "xAxis",
                yAxis: "yAxis",
                closeMemberPath: "Close",
                highMemberPath: "High",
                lowMemberPath: "Low",
                openMemberPath: "Open",
                volumeMemberPath: "Volume"
            }]);
        };
    </script>

    <style type="text/css">
        #priceChart, #indicatorChart
        {
            margin: 10px 0px 10px 0px;
        }       
        
        .selectionOptions
        {
            width: 450px;
            margin-top: 10px;
        }

        .selectionOptions > label 
        {
            display: block;
        }

    </style>

    <div id="priceChart"></div>
    <div id="indicatorChart"></div>

    <div class="selectionOptions">
        <label>Select Indicator:</label>
        <select id="indicatorTypes"></select>
    </div>
    
    <div class="selectionOptions" style="display: inline-block">
        <label>Stock data from:
            <a href="http://www.quandl.com/" target="_blank">Quandl</a>
        </label>
    </div>

</body>
</html>