draw jqplot.enhancedLegendRenderer.js 132:
if (idx < series.length && (series[idx].show || series[idx].showLabel)){
, . , ( - true), . , , showLabel false, .
|| && - . .
Edit:
, , , .
tr , showLabel - false. if :
tr = $(document.createElement('tr'));
tr.addClass('jqplot-table-legend');
if (reverse){
tr.prependTo(this._elem);
}
else{
tr.appendTo(this._elem);
}
(, , if, ):
if (idx < series.length && (series[idx].show && series[idx].showLabel)){
tr = $(document.createElement('tr'));
tr.addClass('jqplot-table-legend');
if (reverse){
tr.prependTo(this._elem);
}
else{
tr.appendTo(this._elem);
}
}
( 212), :
if (this.showLabels) {
console.log(this._elem.find('tr').length - 1);
td2.bind('click', {series:s, speed:speed, plot: plot, replot:this.seriesToggleReplot }, handleToggle);
td2.addClass('jqplot-seriesToggle');
}
, . , , click:
td2.bind('click', {series:s, speed:speed, plot: plot,
replot:this.seriesToggleReplot,
trIndex: this._elem.find('tr').length - 1 }, handleToggle);
trIndex HTML. , .
doLegendToggle :
if (s.canvas._elem.is(':hidden') || !s.show) {
// Not sure if there is a better way to check for showSwatches and showLabels === true.
// Test for "undefined" since default values for both showSwatches and showLables is true.
if (typeof plot.options.legend.showSwatches === 'undefined' || plot.options.legend.showSwatches === true) {
plot.legend._elem.find('td').eq(sidx * 2).addClass('jqplot-series-hidden');
}
if (typeof plot.options.legend.showLabels === 'undefined' || plot.options.legend.showLabels === true) {
plot.legend._elem.find('td').eq((sidx * 2) + 1).addClass('jqplot-series-hidden');
}
}
else {
if (typeof plot.options.legend.showSwatches === 'undefined' || plot.options.legend.showSwatches === true) {
plot.legend._elem.find('td').eq(sidx * 2).removeClass('jqplot-series-hidden');
}
if (typeof plot.options.legend.showLabels === 'undefined' || plot.options.legend.showLabels === true) {
plot.legend._elem.find('td').eq((sidx * 2) + 1).removeClass('jqplot-series-hidden');
}
}
. sidx, , trIndex. sidx d.trIndex.