How to break graph in line diagram of jqplot

jqplot, jquery

Solution

You just have to give a point with `null` as the value of it.

Inside `series` set `breakOnNull: true`.

JSFIDDLE LINK

$.jqplot.config.enablePlugins = true;
var chartData = [[1, 224], [3, 672], [5, null],[15,2240],[17,2000]];

function PlotChart(chartData) {

    var plot2 = $.jqplot('chart1', [chartData], {
        title: 'Mouse Cursor Tracking',
        seriesDefaults: {
            renderer: $.jqplot.CanvasAxisLabelRenderer,
            rendererOptions: {
                smooth: true
            },
            pointLabels: {
                show: true
            },
            breakOnNull: true
        },
        axes: {
            xaxis: {
                label: 'Number of Cookies',
                renderer: $.jqplot.CategoryAxisRenderer,
                // renderer to use to draw the axis,     
                tickOptions: {
                    formatString: '%d'
                }
            },
            yaxis: {
                label: 'Calories',
                tickOptions: {
                    formatString: '%.2f'
                }
            }
        },
        highlighter: {
            sizeAdjust: 7.5
        },
        cursor: {
            show: true
        }
    });
}

PlotChart(chartData);

Problem

How to break a graph line if there is missing value and start again after the next value is enetered.

Original source