Hiding Axis Y in multiple axis chart - CanvasJS JavaScript Charts
Hiding Axis Y in multiple axis chart - 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", {
theme: "light2",
title:{
text: "Multiple Y axis"
},
subtitles: [{
text: "One of the axisY is hidden"
}],
axisY: [
{
title: "Axis Y 1 Title",
lineColor: "#369EAD",
},
{
title: "",
tickThickness: 0,
lineThickness: 0,
labelFormatter: function(){
return " ";
}
}
],
data: [
{
type: "line",
axisXIndex: 0,
dataPoints: [
{ x: 10, y: 6, label:"Apple" },
{ x: 20, y: 2, label:"Mango" },
{ x: 30, y: 5, label:"Orange" },
{ x: 40, y: 7, label:"Banana" },
{ x: 50, y: 1, label:"Pineapple" },
{ x: 60, y: 5, label:"Pears" },
{ x: 70, y: 5, label:"Grapes" },
{ x: 80, y: 2, label:"Lychee" },
{ x: 90, y: 2, label:"Jackfruit" }
]
},
{
type: "line",
axisYIndex: 1,
dataPoints: [
{ x: 10, y: 100, label:"Apple" },
{ x: 20, y: 70, label:"Mango" },
{ x: 30, y: 102, label:"Orange" },
{ x: 40, y: 80, label:"Banana" },
{ x: 50, y: 48, label:"Pineapple" },
{ x: 60, y: 95, label:"Pears" },
{ x: 70, y: 102, label:"Grapes" },
{ x: 80, y: 98, label:"Lychee" },
{ x: 90, y: 156, label:"Jackfruit" }
]
},
]
});
chart.render();