Select missing points display mode:
JavaScript Chart line series with missing data points example.
A live JavaScript/jQuery example of jqxChart, the jQWidgets Chart component, with its complete source code below. It is one of 92 jqxChart demos for jQuery.
title property – Sets or gets the jqxChart title.description property – Sets or gets the jqxChart description.source property – Sets the chart's data source.showLegend property – Determines whether to show or hide the chart series legend.padding propertytitlePadding propertycolorScheme propertyxAxis property – Sets the Chart's xAxis.valueAxis propertyseriesGroups property – The seriesGroups property is used to describe all series displayed on the chart.getInstance methodupdate methodTo run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $. Getting started with jqxChart shows the setup step by step.
The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxdata.js, jqxdraw.js, jqxchart.core.js, jqxbuttons.js, jqxlistbox.js, jqxscrollbar.js, jqxdropdownlist.js.
It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).
$(document).ready(function () {
var sampleData = [29, undefined, 10, 15, 10, undefined, NaN, 30, 25, undefined, 33, 19, 11];
var settings = {
title: "Line serie with missing points",
description: 'Sample line serie with missing and invalid values',
showLegend: true,
padding: { left: 5, top: 5, right: 15, bottom: 5 },
titlePadding: { left: 0, top: 0, right: 0, bottom: 10 },
source: sampleData,
xAxis:
{
text: 'x',
valuesOnTicks: false
},
colorScheme: 'scheme05',
seriesGroups:
[
{
type: 'line',
source: sampleData,
toolTipFormatFunction: function (value, itemIndex, serie, group, categoryValue, categoryAxis) {
var dataItem = sampleData[itemIndex];
return '<DIV style="text-align:left"><b>Index:</b> ' +
itemIndex + '<br /><b>Value:</b> ' +
value + '<br /></DIV>';
},
valueAxis:
{
title: { text: 'Value<br>' }
},
series:
[
{ emptyPointsDisplay: 'skip', displayText: 'Value', lineWidth: 2, symbolSize: 8, symbolType: 'circle' }
]
}
]
};
// create the chart
$("#chartContainer").jqxChart(settings);
// get the chart's instance
var chart = $('#chartContainer').jqxChart('getInstance');
// series type drop down
var modes = ["skip", "zero", "connect"];
$("#dropDownMissingPointsMode").jqxDropDownList({ source: modes, selectedIndex: 0, width: '220', height: '25', dropDownHeight: 77 });
$('#dropDownMissingPointsMode').on('select', function (event) {
var args = event.args;
if (args) {
var value = args.item.value;
chart.seriesGroups[0].series[0].emptyPointsDisplay = value;
chart.update();
}
});
});
<div id="chartContainer" style="width:800px; height:500px"></div>
<p style="font-family: Verdana; font-size: 12px;">Select missing points display mode:
</p>
<div id="dropDownMissingPointsMode">
</div>