(s, i)
| 605 | const soff = {show: false}; |
| 606 | |
| 607 | function initLegendRow(s, i) { |
| 608 | if (i == 0 && (multiValLegend || !legend.live || mode == 2)) |
| 609 | return nullNullTuple; |
| 610 | |
| 611 | let cells = []; |
| 612 | |
| 613 | let row = placeTag("tr", LEGEND_SERIES, legendBody, legendBody.childNodes[i]); |
| 614 | |
| 615 | addClass(row, s.class); |
| 616 | |
| 617 | if (!s.show) |
| 618 | addClass(row, OFF); |
| 619 | |
| 620 | let label = placeTag("th", null, row); |
| 621 | |
| 622 | if (markers.show) { |
| 623 | let indic = placeDiv(LEGEND_MARKER, label); |
| 624 | |
| 625 | if (i > 0) { |
| 626 | let width = markers.width(self, i); |
| 627 | |
| 628 | if (width) |
| 629 | indic.style.border = width + "px " + markers.dash(self, i) + " " + markers.stroke(self, i); |
| 630 | |
| 631 | indic.style.background = markers.fill(self, i); |
| 632 | } |
| 633 | } |
| 634 | |
| 635 | let text = placeDiv(LEGEND_LABEL, label); |
| 636 | |
| 637 | if (s.label instanceof HTMLElement) |
| 638 | text.appendChild(s.label); |
| 639 | else |
| 640 | text.textContent = s.label; |
| 641 | |
| 642 | if (i > 0) { |
| 643 | if (!markers.show) |
| 644 | text.style.color = s.width > 0 ? markers.stroke(self, i) : markers.fill(self, i); |
| 645 | |
| 646 | onMouse("click", label, e => { |
| 647 | if (cursor._lock) |
| 648 | return; |
| 649 | |
| 650 | setCursorEvent(e); |
| 651 | |
| 652 | let seriesIdx = series.indexOf(s); |
| 653 | |
| 654 | if ((e.ctrlKey || e.metaKey) != legend.isolate) { |
| 655 | // if any other series is shown, isolate this one. else show all |
| 656 | let isolate = series.some((s, i) => i > 0 && i != seriesIdx && s.show); |
| 657 | |
| 658 | series.forEach((s, i) => { |
| 659 | i > 0 && setSeries(i, isolate ? (i == seriesIdx ? son : soff) : son, true, syncOpts.setSeries); |
| 660 | }); |
| 661 | } |
| 662 | else |
| 663 | setSeries(seriesIdx, {show: !s.show}, true, syncOpts.setSeries); |
| 664 | }, false); |
no test coverage detected
searching dependent graphs…