Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to break graph in line diagram of jqplot

Tags:

jquery

jqplot

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

like image 617
user2600752 Avatar asked Jul 19 '13 19:07

user2600752


1 Answers

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);
like image 74
Gyandeep Avatar answered Sep 18 '22 17:09

Gyandeep