Create a light-themed chart with reduced side spacing and a line data points.
HTML
<script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 370px; width: 100%; border: 1px solid black;"></div>
JavaScript
var chart = new CanvasJS.Chart('chartContainer', {
animationEnabled: true,
theme: "light2",
title: {
text: 'Chart with Reduced Side Spacing',
},
axisX: {
margin: -4, //Negative margin to reduce extra space
},
axisY: {
title: 'Values',
margin: -4,
},
axisX2: {
margin: -4 //Doesn't get applied as axisX2 is not used
},
axisY2: {
margin: -4 //Doesn't get applied as axisY2 is not used
},
data: [
{
type: 'line',
dataPoints: [
{ x: 1, y: 10 },
{ x: 2, y: 15 },
{ x: 3, y: 25 },
{ x: 4, y: 30 },
{ x: 5, y: 28 },
],
},
],
})
chart.render()