Area Chart with Date-Time axis - CanvasJS JavaScript Charts
Area Chart with Date-Time axis - CanvasJS JavaScript Charts
by canvasjs
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<br/><!-- Just so that JSFiddle's Result label doesn't overlap the Chart -->
<div id="chartContainer" style="height: 360px; width: 100%;"></div>
JavaScript
var chart = new CanvasJS.Chart("chartContainer", {
backgroundColor: "#2e3037",
animationEnabled: true,
axisY :{
includeZero: false,
//prefix: '$',
gridColor: '#79797c',
labelFontSize: 16,
labelFontColor: "#79797c",
valueFormatString: "$#.00"
},
axisX: {
gridColor: '#79797c',
valueFormatString: "MM/DD/YY",
labelAngle: -50,
interval:1,
intervalType: "day",
labelFontColor: '#79797c',
labelFontSize: 10,
},
toolTip: {
//shared: "true",
fontColor: "white",
backgroundColor: "#6b60d4",
content: "${y}",
},
data: [{
type: "area",
showInLegend: false,
color: '#6b60d4',
fillOpacity: .1,
name: "Price at the Close of the Day",
prefix: '$',
markerSize: 0,
dataPoints: [
{x: new Date(2018, 00, 16), y: 1050.26},
{x: new Date(2018, 00, 17), y: 1024.69},
{x: new Date(2018, 00, 18), y: 1012.97},
{x: new Date(2018, 00, 19), y: 1037.36},
{x: new Date(2018, 00, 20), y: 1150.5},
{x: new Date(2018, 00, 21), y: 1049.09},
{x: new Date(2018, 00, 22), y: 999.64},
{x: new Date(2018, 00, 23), y: 984.47},
{x: new Date(2018, 00, 24), y: 1061.78},
{x: new Date(2018, 00, 25), y: 1046.37},
{x: new Date(2018, 00, 26), y: 1048.58},
{x: new Date(2018, 00, 27), y: 1109.08},
{x: new Date(2018, 00, 28), y: 1231.58},
{x: new Date(2018, 00, 29), y: 1169.96},
{x: new Date(2018, 00, 30), y: 1063.75},
{x: new Date(2018, 00, 31), y: 1111.31},
{x: new Date(2018, 01, 01), y: 1026.19},
{x: new Date(2018, 01, 02), y: 917.47},
{x: new Date(2018, 01, 03), y: 970.87},
{x: new Date(2018, 01, 04), y: 827.59},
{x: new Date(2018, 01, 05), y: 695.08},
{x: new Date(2018, 01, 06), y: 785.01},
{x: new Date(2018, 01, 07), y: 751.81},
{x: new Date(2018, 01, 08), y: 813.55},
{x: new...