user2600752
user2600752

Reputation: 73

How to break graph in line diagram of jqplot

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

Upvotes: 6

Views: 3128

Answers (1)

Gyandeep
Gyandeep

Reputation: 13538

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);

Upvotes: 7

Related Questions