(item, i)
| 108 | } |
| 109 | |
| 110 | _generateTipItem(item, i) { |
| 111 | const svg = this.svg.append('svg'); |
| 112 | |
| 113 | svg.append('rect') |
| 114 | .style('fill', item.color) |
| 115 | .attr('width', 8) |
| 116 | .attr('height', 8) |
| 117 | .attr('rx', 2) |
| 118 | .attr('ry', 2) |
| 119 | .attr('filter', this.filter) |
| 120 | .attr('x', 15) |
| 121 | .attr('y', 37 + 20 * i); |
| 122 | |
| 123 | svg.append('text') |
| 124 | .style('font-size', '15') |
| 125 | .style('fill', this.strokeColor) |
| 126 | .attr('x', 15 + 12) |
| 127 | .attr('y', 37 + 20 * i + 8) |
| 128 | .text(item.text); |
| 129 | |
| 130 | const bbox = svg.node().getBBox(); |
| 131 | const width = bbox.width + 15; |
| 132 | const height = bbox.height + 10; |
| 133 | return { |
| 134 | svg, |
| 135 | width, |
| 136 | height, |
| 137 | }; |
| 138 | } |
| 139 | |
| 140 | _getBackgroundWidth() { |
| 141 | const maxItemLength = this.items.reduce( |
no outgoing calls
no test coverage detected