Straight Line Charts - CanvasJS
Straight Line Charts - CanvasJS
HTML
<script src="http://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 360px; width: 100%;"></div>
JavaScript
$(function() {
var chart = new CanvasJS.Chart("chartContainer", {
theme: "light2",
axisY:{
title: "axisY",
includeZero: false
},
axisY2:{
title: "axisY2",
includeZero: false
},
data: [{
type: "line",
markerSize: 2,
lineThickness: 3,
dataPoints: [{
x: 0,
y: 35
},
{
x: 1,
y: 36
},
{
x: 2,
y: 37
},
{
x: 3,
y: 38
},
{
x: 4,
y: 39
},
{
x: 5,
y: 40
},
{
x: 6,
y: 41
},
{
x: 7,
y: 42
},
{
x: 8,
y: 43
},
{
x: 9,
y: 44
},
{
x: 10,
y: 45
},
{
x: 11,
y: 46
},
{
x: 12,
y: 47
},
]
}, {
type: "line",
markerSize: 2,
lineThickness: 3,
axisYType: "secondary",
dataPoints: [{
x: 0,
y: 35
},
{
x: 1,
y: 36
},
{
x: 2,
y: 37
},
{
x: 3,
y: 38
},
{
x: 4,
y: 39
},
{
x: 5,
y: 40
},
{
x: 6,
y: 41
},
{
x: 7,
y: 42
},
{
x: 8,
y: 43
},
{
x: 9,
y: 44
},
{
x: 10,
y: 45
},
{
x: 11,
y: 46
},
{
x: 12,
y: 47
},
]
}]
});
chart.render();
var xSnapDistance = 2 / 2;
var ySnapDistance = 2;
var xValue, yValue;
var mouseDown = false;
var selected = null;
var changeCursor = false;
...