JSFiddle - React, Tailwind, and code Playground
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:"#c0c0c0",
title:{
text: "Chart Background(s) with a twist"
},
axisY:{
stripLines:[{
startValue:-1000,
endValue:1000,
color:"#FFFFBB",
/* opacity:0.7 */
}],
},
axisX:{
stripLines:[
{
startValue:2,
endValue:4,
color:"blue",
showOnTop: true,
opacity: 0.6
},
{
startValue:14,
endValue:16,
color:"blue",
showOnTop: true,
opacity: 0.6
},
],
},
data: [
{
type: "line",
dataPoints: [
{ y: 450 },
{ y: 414},
{ y: 18 },
{ y: 80 },
{ y: 450 },
{ y: 500 },
{ y: 480 },
{ y: 480 },
{ y: 410 },
{ y: 500 },
{ y: 480 },
{ y: 510 },
{ y: 450 },
{ y: 414},
{ y: 18 },
{ y: 80 },
{ y: 450 },
{ y: 500 },
{ y: 480 },
{ y: 480 },
{ y: 410 },
{ y: 500 },
{ y: 480 },
{ y: 510 },
]
}
]
});
chart.render();