JavaScript
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer",{
title: {
text: "Show ToolTip for Missing DataPoints"
},
toolTip: {
shared: true
},
axisX: {
gridColor: "Silver",
valueFormatString: "DD/MMM"
},
axisY: {
includeZero: false
},
data: [{
type: "stepLine",
showInLegend: true,
name: "Visits",
dataPoints: [
{ x: new Date(2010, 0, 3), y: 684 },
{ x: new Date(2010, 0, 5), y: 700 },
{ x: new Date(2010, 0, 7), y: 710 },
{ x: new Date(2010, 0, 10), y: 710, toolTipContent: null },
{ x: new Date(2010, 0, 10), y: null, toolTipContent: null },
{ x: new Date(2010, 0, 11), y: 734 },
{ x: new Date(2010, 0, 13), y: 963 },
{ x: new Date(2010, 0, 15), y: 847 },
{ x: new Date(2010, 0, 17), y: 853 },
{ x: new Date(2010, 0, 19), y: 869 },
{ x: new Date(2010, 0, 21), y: 943 },
{ x: new Date(2010, 0, 23), y: 970 }
]
},{
type: "stepLine",
showInLegend: true,
name: "Unique Visits",
dataPoints: [
{ x: new Date(2010, 0, 3), y: 510 },
{ x: new Date(2010, 0, 5), y: 560 },
{ x: new Date(2010, 0, 7), y: 540 },
{ x: new Date(2010, 0, 9), y: 558 },
{ x: new Date(2010, 0, 11), y: 544 },
{ x: new Date(2010, 0, 13), y: 693 },
{ x: new Date(2010, 0, 15), y: 657 },
{ x: new Date(2010, 0, 17), y: 663 },
{ x: new Date(2010, 0, 19), y: 639 },
{ x: new Date(2010, 0, 21), y: 673 },
{ x: new Date(2010, 0, 23), y: 660 }
]
}]
});
addMissingDataPoints(chart);
chart.render();
function addMissingDataPoints(chart) {
var missingValues = [];
for(var i = 0; i < chart.options.data.length; i++) {
missingValues[i] = [];
var dataSeriesToBeChecked = chart.options.data[i];
for(var j = 0; j < chart.options.data.length; j++) {
if(j == i)...