(renderer?: Renderer)
| 599 | */ |
| 600 | public renderer(renderer: Renderer): this; |
| 601 | public renderer(renderer?: Renderer): Renderer | this { |
| 602 | if (renderer === undefined) { |
| 603 | return this._canvas == null ? "svg" : "canvas"; |
| 604 | } else { |
| 605 | if (this._canvas == null && renderer === "canvas") { |
| 606 | // construct the canvas, remove drawer's renderAreas, set drawer's canvas |
| 607 | this._canvas = d3.select(document.createElement("canvas")).classed("plot-canvas", true); |
| 608 | this._bufferCanvas = d3.select(document.createElement("canvas")); |
| 609 | if (this.element() != null) { |
| 610 | this._appendCanvasNode(); |
| 611 | } |
| 612 | this._datasetToDrawer.forEach((drawer) => { |
| 613 | drawer.useCanvas(this._canvas); |
| 614 | }); |
| 615 | this.render(); |
| 616 | } else if (this._canvas != null && renderer == "svg") { |
| 617 | this._canvas.remove(); |
| 618 | this._canvas = null; |
| 619 | this._bufferCanvas = null; |
| 620 | this._datasetToDrawer.forEach((drawer) => { |
| 621 | drawer.useSVG(this._renderArea); |
| 622 | }); |
| 623 | this.render(); |
| 624 | } |
| 625 | return this; |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | /** |
| 630 | * Adds a Dataset to the Plot. |
no test coverage detected