This sample demonstrates how to set the axis margins.
For detailed implementation, please take a look at the HTML code tab.
<!DOCTYPE html>
<html>
<head>
<title>Axis Margins Example - JavaScript Chart by dvxCharts</title>
<link rel="stylesheet" type="text/css" href="../../css/dvxCharts.chart.min.css" />
<link rel="stylesheet" type="text/css" href="../../themes/base/styles.css" />
<script src="../../js/dvxCharts.chart.min.js" type="text/javascript"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<style>
.example-container {
width: 100%;
max-width: 500px;
height: 300px;
}
</style>
<script lang="javascript" type="text/javascript">
var chart = new dvxCharts.Chart({
title: {
text: 'Axis Margins'
},
animation: {
duration: 1
},
axes: [
{
location: 'bottom',
leftMargin: 0,
rightMargin: 0
},
{
location: 'left',
bottomMargin: 90,
topMargin: 20
}
],
series: [
{
type: 'splineArea',
data: [[10, 56], [20, 30], [30, 62], [40, 70], [50, 40], [60, 36], [70, 60]]
},
{
type: 'splineArea',
data: [[10, 46], [20, 25], [30, 48], [40, 35], [50, 32], [60, 30], [70, 40]]
},
{
type: 'splineArea',
data: [[10, 26], [20, 20], [30, 38], [40, 32], [50, 22], [60, 24], [70, 20]]
}
]
});
chart.write('container');
</script>
</head>
<body>
<div>
<div id="container" class="example-container">
</div>
</div>
</body>
</html>