I'm struggling with creating multiple objects based on input data. I've tried using an array, but it requires knowing the number of objects in advance. Does anyone have a solution for this?
Here is my code snippet -
module powerbi.extensibility.visual {
export class Visual implements IVisual {
private lines: d3.Selection<SVGElement>[];
private svg: d3.Selection<SVGElement>;
private container: d3.Selection<SVGElement>;
constructor(options: VisualConstructorOptions) {
this.svg = d3.select(options.element)
.classed("svg",true)
this.container = this.svg.append("g")
.classed("container", true)
var a = []
for(var i = 0; i < 5; ++i){
a[i] = this.container.append("line")
.classed("line_"+String(i), true)
}
this.lines = a;
}
public update(options: VisualUpdateOptions) {
}
}
}