Forum Discussion

az2451's avatar
az2451
Resolver I
8 years ago
Solved

How 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...
  • v-viig's avatar
    v-viig
    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

    [email protected]

  • az2451's avatar
    az2451
    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');