2👍
✅
Within the chart options you can define if the yAxis
is displayed or not.
options: {
...
scales: {
yAxes: [{
display: false
}]
}
}
Please check the following runnable code snippet.
var lineChartData = {
labels: ["FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER", "JANUARY", "FEBRUARY", "MARCH", "APRIL"],
datasets: [{
label: "X",
fillColor: "#ff1e6d",
strokeColor: "#ff1e6d",
pointColor: "#ff1e6d",
data: [290, 390, 300, 440, 625, 375, 390, 325, 280, 295, 385, 295, 485, 280, 265]
}, {
label: "Y",
fillColor: "#ffc000",
strokeColor: "rgba(220,180,0,1)",
pointColor: "#ffc000",
data: [190, 200, 420, 390, 150, 250, 160, 155, 200, 260, 240, 500, 300, 210, 230, 270]
}]
}
Chart.defaults.global.animationSteps = 50;
Chart.defaults.global.tooltipYPadding = 0;
Chart.defaults.global.tooltipCornerRadius = 0;
Chart.defaults.global.tooltipTitleFontStyle = "normal";
Chart.defaults.global.tooltipFillColor = "rgba(0,160,0,0.8)";
Chart.defaults.global.animationEasing = "easeOutBounce";
Chart.defaults.global.responsive = true;
Chart.defaults.global.scaleLineColor = "#816cab";
Chart.defaults.global.scaleFontSize = 11;
Chart.defaults.global.scaleFontColor = "white";
new Chart(document.getElementById("fill"), {
type: 'line',
data: lineChartData,
options: {
pointDotRadius: 0,
bezierCurve: true,
scaleShowVerticalLines: false,
scaleGridLineColor: "transparent",
scales: {
yAxes: [{
display: false
}]
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script>
<canvas id="fill"></canvas>
Source:stackexchange.com