4

If I run this code below in jqplot I get all lines(series) rendered on the graph:

series:
    [   


        {label:'qqq', color:'#CD0000',show:true},
        {label:'www', color:'#FFAA00',show:true},
        {label:'eee', color:'#9CCB19',show:true},
        {label:'ddd', color:'#3299CC',show:true},
        {label:'ccc', color:'#871F78',show:true},
        {label:'ggg', color:'#BF5FFF',show:true}
    ],

but if I run this code below to show only one series on the graph which is fine and the others are crossed out, but if I want to enable them again by unticking them, this does not work anymore:

series:
        [   


            {label:'qqq', color:'#CD0000',show:true},
            {label:'www', color:'#FFAA00',show:false},
            {label:'eee', color:'#9CCB19',show:false},
            {label:'ddd', color:'#3299CC',show:false},
            {label:'ccc', color:'#871F78',show:false},
            {label:'ggg', color:'#BF5FFF',show:false}
        ],

Can anyone help please?

medzi
  • 407
  • 1
  • 8
  • 20

3 Answers3

4

you can do it by using this piece of code:

graphPlot.series[0].show = true;

graphPlot.redraw(false);

You can also specify the index of any series in the above code and then make its show property to true or false.

Gyandeep
  • 12,726
  • 4
  • 31
  • 42
1

Add seriesToggle under the legend/rendererOptions with a value other than 'off' http://www.jqplot.com/docs/files/plugins/jqplot-enhancedLegendRenderer-js.html#seriesToggle

false to not enable series on/off toggling on the legend. true or a fadein/fadeout speed (number of milliseconds or ‘fast’, ‘normal’, ‘slow’) to enable show/hide of series on click of legend item.

BlackTigerX
  • 6,006
  • 7
  • 38
  • 48
-1

You can find a working example here

Once you have implemented something and if you still have troubles feel free to ask for any help.

AnthonyLeGovic
  • 2,335
  • 1
  • 13
  • 22