in src/visualComponent/table/cell/sparkline/sparklineCellComponent.ts [93:153]
public render(options: ISparklineCellRenderOptions): void {
this.renderOptions = options;
const {
order,
series,
offset,
series: {
settings,
},
} = options;
this.updateOrder(order);
this.updateBackgroundColor(
this.element,
settings.sparklineSettings.backgroundColor,
);
const viewport: powerbi.IViewport = this.getViewport();
const filteredPoints: IDataRepresentationPointSet[] = series.points
.filter((pointSet: IDataRepresentationPointSet, pointSetIndex: number) => {
return pointSet && pointSet.isShown;
});
this.positions = this.getPositions(
viewport,
series.x.scale,
series.axisValues,
offset,
);
const amountOfLines: number = filteredPoints.length;
this.components
.splice(amountOfLines)
.forEach((component: IVisualComponent) => {
component.clear();
component.destroy();
});
if (this.components.length < amountOfLines) {
for (let index: number = this.components.length; index < amountOfLines; index++) {
this.components.push(new LineComponent({
dataPointFilter: DataRepresentationPointFilter.create(),
element: this.mainGroupElement,
}));
}
}
filteredPoints.forEach((pointSet: IDataRepresentationPointSet, index: number) => {
this.components[index].render({
offset,
points: pointSet,
viewport,
x: series.x,
y: series.y,
} as ILineRenderOptions);
});
}