|
167 | 167 | td2 = $(document.createElement('td'));
|
168 | 168 | td2.addClass('jqplot-table-legend jqplot-table-legend-label');
|
169 | 169 | td2.css('paddingTop', rs);
|
170 |
| - |
| 170 | + //Issue-177 | added jqplot series class reference jqplot-table-legend-series-[sidx] - used to locate legend td element for series. |
| 171 | + td2.addClass("jqplot-table-legend-series-" + idx); |
| 172 | + |
171 | 173 | // td1 = $('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+rs+';">'+
|
172 | 174 | // '<div><div class="jqplot-table-legend-swatch" style="background-color:'+color+';border-color:'+color+';"></div>'+
|
173 | 175 | // '</div></td>');
|
|
274 | 276 | }
|
275 | 277 | var s = plot.series[sidx];
|
276 | 278 |
|
| 279 | + //Issue-177 | removed element index based location of series legend element and replaced with explicit class reference jqplot-table-legend-series-[sidx] |
277 | 280 | if (s.canvas._elem.is(':hidden') || !s.show) {
|
278 |
| - // Not sure if there is a better way to check for showSwatches and showLabels === true. |
279 |
| - // Test for "undefined" since default values for both showSwatches and showLables is true. |
280 |
| - if (typeof plot.options.legend.showSwatches === 'undefined' || plot.options.legend.showSwatches === true) { |
281 |
| - plot.legend._elem.find('td').eq(sidx1 * 2).addClass('jqplot-series-hidden'); |
282 |
| - } |
283 |
| - if (typeof plot.options.legend.showLabels === 'undefined' || plot.options.legend.showLabels === true) { |
284 |
| - plot.legend._elem.find('td').eq((sidx1 * 2) + 1).addClass('jqplot-series-hidden'); |
285 |
| - } |
| 281 | + plot.legend._elem.find('td.jqplot-table-legend-series-' + sidx).addClass('jqplot-series-hidden'); |
286 | 282 | }
|
287 | 283 | else {
|
288 |
| - if (typeof plot.options.legend.showSwatches === 'undefined' || plot.options.legend.showSwatches === true) { |
289 |
| - plot.legend._elem.find('td').eq(sidx1 * 2).removeClass('jqplot-series-hidden'); |
290 |
| - } |
291 |
| - if (typeof plot.options.legend.showLabels === 'undefined' || plot.options.legend.showLabels === true) { |
292 |
| - plot.legend._elem.find('td').eq((sidx1 * 2) + 1).removeClass('jqplot-series-hidden'); |
293 |
| - } |
| 284 | + plot.legend._elem.find('td.jqplot-table-legend-series-' + sidx).removeClass('jqplot-series-hidden'); |
294 | 285 | }
|
295 | 286 |
|
296 | 287 | }
|
|
0 commit comments