drawGraph() {
      const grid = document.createElement("g");
      grid.setAttribute("class", "graph-svg-group");
      const values = this.getValues();
      const usableHeight = this.height - this.padding.bottom - this.padding.top;
      const max = this.utility.getMaxValue(values);
      const min = this.utility.getMinValue(values);
      const positiveMin = min < 0 ? this.utility.toPositive(min) : min;

      values.forEach((val, index) => {
        const line = document.createElement("line");
        const pointY = this.getPointYAxis(usableHeight, (max + positiveMin), (val + positiveMin));
        if (index < 1) {
          line.setAttribute("x1", `${this.xCoords[index]}px`);
          line.setAttribute("y1", `${pointY}px`);
          line.setAttribute("x2", `${this.xCoords[index]}px`);
          line.setAttribute("y2", `${pointY}px`);
        } else {
          line.setAttribute("x1", `${this.xCoords[index - 1]}px`);
          line.setAttribute("y1", `${this.yCoords[index - 1]}px`);
          line.setAttribute("x2", `${this.xCoords[index]}px`);
          line.setAttribute("y2", `${pointY}px`);
        }
        line.setAttribute("stroke", `${this.lineColor}`);
        line.setAttribute("stroke-width", "3");
        grid.appendChild(line);
        this.yCoords.push(pointY);
      });

      return grid;
    }
/**
     * Plots the graph data and return the SVG group of lines plotted.
     * @returns {SVGGElement}
     */
Plots the graph data and return the SVG group of lines plotted.
Plots the graph data and return the SVG group of lines plotted .
drawGraph() {
      const grid = document.createElement("g");
      grid.setAttribute("class", "graph-svg-group");
      const values = this.getValues();
      const usableHeight = this.height - this.padding.bottom - this.padding.top;
      const max = this.utility.getMaxValue(values);
      const min = this.utility.getMinValue(values);
      const positiveMin = min < 0 ? this.utility.toPositive(min) : min;
      values.forEach((val, index) => {
        const line = document.createElement("line");
        const pointY = this.getPointYAxis(usableHeight, (max + positiveMin), (val + positiveMin));
        if (index < 1) {
          line.setAttribute("x1", `${this.xCoords[index]}px`);
          line.setAttribute("y1", `${pointY}px`);
          line.setAttribute("x2", `${this.xCoords[index]}px`);
          line.setAttribute("y2", `${pointY}px`);
        } else {
          line.setAttribute("x1", `${this.xCoords[index - 1]}px`);
          line.setAttribute("y1", `${this.yCoords[index - 1]}px`);
          line.setAttribute("x2", `${this.xCoords[index]}px`);
          line.setAttribute("y2", `${pointY}px`);
        }
        line.setAttribute("stroke", `${this.lineColor}`);
        line.setAttribute("stroke-width", "3");
        grid.appendChild(line);
        this.yCoords.push(pointY);
      });
      return grid;
    }
drawGraph ( ) { const grid = document . createElement ( "g" ) ; grid . setAttribute ( "class" , "graph-svg-group" ) ; const values = this . getValues ( ) ; const usableHeight = this . height - this . padding . bottom - this . padding . top ; const max = this . utility . getMaxValue ( values ) ; const min = this . utility . getMinValue ( values ) ; const positiveMin = min < 0 ? this . utility . toPositive ( min ) : min ; values . forEach ( ( val , index ) => { const line = document . createElement ( "line" ) ; const pointY = this . getPointYAxis ( usableHeight , ( max + positiveMin ) , ( val + positiveMin ) ) ; if ( index < 1 ) { line . setAttribute ( "x1" , ` ${ this . xCoords [ index ] } ` ) ; line . setAttribute ( "y1" , ` ${ pointY } ` ) ; line . setAttribute ( "x2" , ` ${ this . xCoords [ index ] } ` ) ; line . setAttribute ( "y2" , ` ${ pointY } ` ) ; } else { line . setAttribute ( "x1" , ` ${ this . xCoords [ index - 1 ] } ` ) ; line . setAttribute ( "y1" , ` ${ this . yCoords [ index - 1 ] } ` ) ; line . setAttribute ( "x2" , ` ${ this . xCoords [ index ] } ` ) ; line . setAttribute ( "y2" , ` ${ pointY } ` ) ; } line . setAttribute ( "stroke" , ` ${ this . lineColor } ` ) ; line . setAttribute ( "stroke-width" , "3" ) ; grid . appendChild ( line ) ; this . yCoords . push ( pointY ) ; } ) ; return grid ; }
Plots the graph data and return the SVG group of lines plotted.
Plots the graph data and return the SVG group of lines plotted .