Scale / Axis Break can be very useful to display two distinct ranges in the same chart area. Line chart supports scale / axis breaks on both axes like any other CanvasJS Graph. Given example shows Line Chart with axis break. It also contains source code that you can edit in-browser or save to run locally.
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title:{
text: "Website Traffic"
},
axisX:{
valueFormatString: "DD MMM"
},
axisY: {
title: "Number of Visitors",
scaleBreaks: {
autoCalculate: true
}
},
data: [{
type: "line",
xValueFormatString: "DD MMM",
color: "#F08080",
dataPoints: [
{ x: new Date(2017, 0, 1), y: 610 },
{ x: new Date(2017, 0, 2), y: 680 },
{ x: new Date(2017, 0, 3), y: 690 },
{ x: new Date(2017, 0, 4), y: 700 },
{ x: new Date(2017, 0, 5), y: 710 },
{ x: new Date(2017, 0, 6), y: 658 },
{ x: new Date(2017, 0, 7), y: 734 },
{ x: new Date(2017, 0, 8), y: 963 },
{ x: new Date(2017, 0, 9), y: 847 },
{ x: new Date(2017, 0, 10), y: 853 },
{ x: new Date(2017, 0, 11), y: 869 },
{ x: new Date(2017, 0, 12), y: 943 },
{ x: new Date(2017, 0, 13), y: 970 },
{ x: new Date(2017, 0, 14), y: 869 },
{ x: new Date(2017, 0, 15), y: 890 },
{ x: new Date(2017, 0, 16), y: 930 },
{ x: new Date(2017, 0, 17), y: 1850 },
{ x: new Date(2017, 0, 18), y: 1905 },
{ x: new Date(2017, 0, 19), y: 1980 },
{ x: new Date(2017, 0, 20), y: 1858 },
{ x: new Date(2017, 0, 21), y: 1034 },
{ x: new Date(2017, 0, 22), y: 963 },
{ x: new Date(2017, 0, 23), y: 847 },
{ x: new Date(2017, 0, 24), y: 853 },
{ x: new Date(2017, 0, 25), y: 869 },
{ x: new Date(2017, 0, 26), y: 943 },
{ x: new Date(2017, 0, 27), y: 970 },
{ x: new Date(2017, 0, 28), y: 869 },
{ x: new Date(2017, 0, 29), y: 890 },
{ x: new Date(2017, 0, 30), y: 930 },
{ x: new Date(2017, 0, 31), y: 750 }
]
}]
});
chart.render();
}
You can customize the way breaks are represented in chart using type property. Other commonly used customization options are lineThickness, startValue, endValue, spacing, collapsibleThreshold etc.