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", {
axisY: {
maximum: 1000,
gridThickness: 0,
},
axisX2: {
labelFormatter: function(e) {
return "";
},
tickColor: "transparent",
//lineThickness: 0,
stripLines: [
{
value: 20,
color:"#b3db8f",
label:"\u25C0 Injection 1",
labelPlacement:"outside",
labelFontColor: "#b3db8f",
labelBackgroundColor: "transparent"
},
{
value: 50,
color:"#b3db8f",
label:"\u25C0 Injection 2",
labelPlacement:"outside",
labelFontColor: "#b3db8f",
labelBackgroundColor: "transparent"
},
{
value: 80,
color:"#b3db8f",
label:"\u25C0 Injection 3",
labelPlacement:"outside",
labelFontColor: "#b3db8f",
labelBackgroundColor: "transparent"
}
]
},
data: [{
type: "line",
dataPoints: [
{ x: 10, y: 710 },
{ x: 20, y: 550 },
{ x: 30, y: 500 },
{ x: 40, y: 650 },
{ x: 50, y: 950 },
{ x: 60, y: 680 },
{ x: 70, y: 280 },
{ x: 80, y: 340 },
{ x: 90, y: 140 }
]
}, {
axisXType: "secondary",
dataPoints: []
}]
});
chart.render();
chart.axisX2[0].set("minimum", chart.axisX[0].get("minimum"), false);
chart.axisX2[0].set("maximum", chart.axisX[0].get("maximum"));