Forum Discussion
az2451
Resolver I
8 years agoHow to draw a linear line by using a given slope
Hello there, i have an urgent problem here that i cant solve... I'm trying to draw a linear line in a scatter plot to visualize a given slope-value. First of all, this is how i calculate m...
- 8 years ago
The width and height are not supported by a line element.
It seems you should apply a color to this line.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
- 8 years ago
Thanks this worked for me:
let sLine = this.g .append('g') .append('line') .classed('sLine', true) .attr('x1', x(0)) .attr('y1', y(0)) .attr('x2', x(viewModel.dataMax * this.slopeVal[0])) .attr('y2', y(viewModel.dataMax)) .attr('stroke', 'red');
v-viig
Community Champion
8 years agoThe line is always rendered at the same position as you use fixed coordinates (.attr('x', x(0)) .attr('y', y(30))).
We'd recommned to use dynamic coordinates instead.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals