igDataChart tests

by georgianastasov

HTML

<script src="https://igniteui.com/js/modernizr.min.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/infragistics.core.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/infragistics.dv.js"></script>
<script src="https://igniteui.com/js-data/world-energy-production"></script>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet"></link>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/structure/infragistics.css" rel="stylesheet"></link>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/structure/modules/infragistics.ui.chart.css" rel="stylesheet"></link>

<div>
        <div>
            <div id="chart" class="chart"></div>
        </div> 
    </div>

CSS

.tooltip { margin: 0px 5px 0px 5px; }

        .chart {
            display: inline-block;
        }
        .legend {
            display: inline-block; 
        }

JavaScript

$(function () {
            var data = [
    { x: 1, y: 10 },
    { x: 2, y: 12 },
    { x: 3, y: 8 },
    { x: 4, y: 15 },
    { x: 5, y: 13 }
];

            $("#chart").igDataChart({
    // set the width and height of the chart
    width: "500px",
    height: "300px",
    // set the type of the chart series
    series: [{
        type: "column",
        // set the name of the series
        name: "series1",
        // set the property of the data source that contains the x-axis values
        xAxis: "xAxis",
        // set the property of the data source that contains the y-axis values
        yAxis: "yAxis",
        // set the property of the data source that contains the values for the series
        valueMemberPath: "y"
    }],
    // set the data source for the chart
    dataSource: data,
    // set the axes for the chart
    axes: [{
        // set the name of the x-axis
        name: "xAxis",
        // set the type of the x-axis
        type: "numericX",
        // set the title of the x-axis
        title: "X"
    }, {
        // set the name of the y-axis
        name: "yAxis",
        // set the type of the y-axis
        type: "numericY",
        // set the title of the y-axis
        title: "Y"
    }],
    // add the value overlay annotation to show the horizontal target line
    annotations: [{
        type: "valueOverlay",
        // set the axis to use as a reference
        axis: "yAxis",
        // set the value to draw the line at
        value: 50,
        // set the color and width of the line
        brush: "green",
        thickness: 2,
    }]
});

});