()
| 103 | } |
| 104 | |
| 105 | public updateGraph() { |
| 106 | if (!this.stopped) { |
| 107 | const data = this.processData(this.datasource.getProgramCounterStats()); |
| 108 | |
| 109 | this.g.selectAll('.arc').remove(); |
| 110 | const arc = this.g.selectAll('.arc') |
| 111 | .data(this.pie(data)) |
| 112 | .enter().append('g').attr('class', 'arc'); |
| 113 | |
| 114 | arc.append('path') |
| 115 | .attr('d', this.path) |
| 116 | .attr('fill', (d: any, index: number) => hashStringToColor(d.data.name)) |
| 117 | .attr('fill-opacity', 0.65) |
| 118 | .attr('stroke', (d: any, index: number) => hashStringToColor(d.data.name)); |
| 119 | |
| 120 | this.legend.selectAll('.entry').remove(); |
| 121 | const entry = this.legend.selectAll('.entry') |
| 122 | .data(data) |
| 123 | .enter().append('g').attr('class', 'entry').attr('transform', (d: any, index: number) => `translate(0,${index * 35})`); |
| 124 | |
| 125 | entry.append('rect') |
| 126 | .attr('width', 30) |
| 127 | .attr('height', 20) |
| 128 | .attr('fill', (d: any, index: number) => hashStringToColor(d.name)) |
| 129 | .attr('fill-opacity', 0.65) |
| 130 | .attr('stroke', (d: any, index: number) => hashStringToColor(d.name)); |
| 131 | entry.append('text').text((d: any) => d.name).attr('x', 40).attr('y', 15); |
| 132 | } |
| 133 | |
| 134 | window.requestAnimationFrame(this.updateGraph.bind(this)); |
| 135 | } |
| 136 | |
| 137 | public stop() { |
| 138 | this.stopped = true; |
nothing calls this directly
no test coverage detected