$(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,
}]
});
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.