function DrawHorizontalTicks
335095
function FormatYTickLabel($which_ylab) {
    switch ($this->y_grid_label_type) {
      case "data":
        $ylab = number_format($which_ylab,$this->y_precision,".",",") . "$this->si_units";
      break;
      case "none":
        $ylab = '';
      break;
      case "time":
        $ylab = strftime($this->y_time_format,$which_ylab);
      break;
      case "right":
        //Make it right aligned
        //$ylab = str_pad($which_ylab,$this->y_label_width," ",STR_PAD_LEFT); //PHP4 only
        $sstr = "%".strlen($this->plot_max_y)."s";
        $ylab = sprintf($sstr,$which_ylab);
      break;
      default:
        //Unchanged from whatever format is passed in
        $ylab = $which_ylab;
      break;
    }

    return($ylab);

  }
908301
function drawVerticalBars(bars) {
            // Enter + Update
            bars.enter()
              .append('rect')
                .classed('bar', true)
                .attr('x', chartWidth)
                .attr('y', ({value}) => yScale(value))
                .attr('width', xScale.bandwidth())
                .attr('height', ({value}) => chartHeight - yScale(value))
                .on('mouseover', function(d, index, barList) {
                    handleMouseOver(this, d, barList, chartWidth, chartHeight);
                })
                .on('mousemove', function(d) {
                    handleMouseMove(this, d, chartWidth, chartHeight);
                })
                .on('mouseout', function(d, index, barList) {
                    handleMouseOut(this, d, barList, chartWidth, chartHeight);
                })
                .on('click', function(d) {
                    handleClick(this, d, chartWidth, chartHeight);
                })
              .merge(bars)
                .attr('x', ({name}) => xScale(name))
                .attr('y', ({value}) => yScale(value))
                .attr('width', xScale.bandwidth())
                .attr('height', ({value}) => chartHeight - yScale(value))
                .attr('fill', ({name}) => computeColor(name));
        }
714281
function drawGridLines(){
            if (maskGridLines) {
                svg.selectAll('.horizontal-grid-line').remove();
            }
            if (baseLine) {
                svg.selectAll('.extended-x-line').remove();
            }

            maskGridLines = svg.select('.grid-lines-group')
                .selectAll('line.horizontal-grid-line')
                .data(yScale.ticks(yTicks))
                .enter()
                  .append('line')
                    .attr('class', 'horizontal-grid-line')
                    .attr('x1', (xAxisPadding.left))
                    .attr('x2', chartWidth)
                    .attr('y1', (d) => yScale(d))
                    .attr('y2', (d) => yScale(d));

            if (baseLine) {
                svg.selectAll('.extended-x-line').remove();
            }

            //draw a horizontal line to extend x-axis till the edges
            baseLine = svg.select('.grid-lines-group')
                .selectAll('line.extended-x-line')
                .data([0])
                .enter()
                  .append('line')
                    .attr('class', 'extended-x-line')
                    .attr('x1', (xAxisPadding.left))
                    .attr('x2', chartWidth)
                    .attr('y1', chartHeight)
                    .attr('y2', chartHeight);
        }
130284
function drawHorizontalRule(editor) {
	var cm = editor.codemirror;
	var stat = getState(cm);
	var options = editor.options;
	_replaceSelection(cm, stat.image, options.insertTexts.horizontalRule);
}
118525
function drawAxis() {
            if (isHorizontal) {
                svg.select('.x-axis-group .axis.x')
                    .attr('transform', `translate( 0, ${chartHeight} )`)
                    .call(xAxis);

                svg.select('.y-axis-group.axis')
                    .attr('transform', `translate( ${-xAxisPadding.left}, 0)`)
                    .call(yAxis);
            } else {
                svg.select('.x-axis-group .axis.x')
                    .attr('transform', `translate( 0, ${chartHeight} )`)
                    .call(xAxis);

                svg.select('.y-axis-group.axis')
                    .attr('transform', `translate( ${-xAxisPadding.left}, 0)`)
                    .call(yAxis)
                    .call(adjustYTickLabels);
            }

            if (yAxisLabel) {
                if (yAxisLabelEl) {
                    svg.selectAll('.y-axis-label-text').remove();
                }

                yAxisLabelEl = svg.select('.y-axis-label')
                    .append('text')
                        .classed('y-axis-label-text', true)
                        .attr('x', -chartHeight / 2)
                        .attr('y', yAxisLabelOffset)
                        .attr('text-anchor', 'middle')
                        .attr('transform', 'rotate(270 0 0)')
                        .text(yAxisLabel)
            }
        }
232313
function drawGridLines() {
            let scale = isHorizontal ? xScale : yScale;

            svg.select('.grid-lines-group')
                .selectAll('line')
                .remove();

            if (grid === 'horizontal' || grid === 'full') {
                svg.select('.grid-lines-group')
                    .selectAll('line.horizontal-grid-line')
                    .data(scale.ticks(yTicks).slice(1))
                    .enter()
                      .append('line')
                        .attr('class', 'horizontal-grid-line')
                        .attr('x1', (-xAxisPadding.left + 1))
                        .attr('x2', chartWidth)
                        .attr('y1', (d) => yScale(d))
                        .attr('y2', (d) => yScale(d));
            }

            if (grid === 'vertical' || grid === 'full') {
                svg.select('.grid-lines-group')
                    .selectAll('line.vertical-grid-line')
                    .data(scale.ticks(xTicks).slice(1))
                    .enter()
                      .append('line')
                        .attr('class', 'vertical-grid-line')
                        .attr('y1', 0)
                        .attr('y2', chartHeight)
                        .attr('x1', (d) => xScale(d))
                        .attr('x2', (d) => xScale(d));
            }

            if (isHorizontal) {
                drawVerticalExtendedLine();
            } else {
                drawHorizontalExtendedLine();
            }
        }
1177081
function drawDataPointsValueHighlights(data) {
            showCrossHairComponentsWithLabels(true);

            // Draw line perpendicular to y-axis
            highlightCrossHairContainer.selectAll('line.highlight-y-line')
              .attr('stroke', nameColorMap[data.name])
              .attr('class', 'highlight-y-line')
              .attr('x1', (xScale(data.x) - areaScale(data.y)))
              .attr('x2', 0)
              .attr('y1', yScale(data.y))
              .attr('y2', yScale(data.y));


            // Draw line perpendicular to x-axis
            highlightCrossHairContainer.selectAll('line.highlight-x-line')
              .attr('stroke', nameColorMap[data.name])
              .attr('class', 'highlight-x-line')
              .attr('x1', xScale(data.x))
              .attr('x2', xScale(data.x))
              .attr('y1', (yScale(data.y) + areaScale(data.y)))
              .attr('y2', chartHeight);

            // Draw data label for y value
            highlightCrossHairLabelsContainer.selectAll('text.highlight-y-legend')
              .attr('text-anchor', 'middle')
              .attr('fill', nameColorMap[data.name])
              .attr('class', 'highlight-y-legend')
              .attr('y', (yScale(data.y) + (areaScale(data.y) / 2)))
              .attr('x', highlightTextLegendOffset)
              .text(`${d3Format.format(yAxisFormat)(data.y)}`);

            // Draw data label for x value
            highlightCrossHairLabelsContainer.selectAll('text.highlight-x-legend')
              .attr('text-anchor', 'middle')
              .attr('fill', nameColorMap[data.name])
              .attr('class', 'highlight-x-legend')
              .attr('transform', `translate(0, ${chartHeight - highlightTextLegendOffset})`)
              .attr('x', (xScale(data.x) - (areaScale(data.y) / 2)))
              .text(`${d3Format.format(xAxisFormat)(data.x)}`);
        }
896707
def _DrawHours(self):
    
    tmpstrs = []
    for i in range(0, self._gwidth, self._min_grid):
      if i % self._hour_grid == 0:
        tmpstrs.append('<polyline class="FullHour" points="%d,%d, %d,%d" />' \
                       % (i + .5 + 20, 20, i + .5 + 20, self._gheight))
        tmpstrs.append('<text class="Label" x="%d" y="%d">%d</text>'
                       % (i + 20, 20,
                         (i / self._hour_grid + self._offset) % 24))
      else:
        tmpstrs.append('<polyline class="SubHour" points="%d,%d,%d,%d" />' \
                       % (i + .5 + 20, 20, i + .5 + 20, self._gheight))
    return "".join(tmpstrs)
1342756
function () {

      function draw(color, n) {
        n = Math.max(parseInt(n), 0);

        write(' ');
        write('\u001b[' + color + 'm' + n + '\u001b[0m');
        write('\n');
      }

      draw(colors.green, this.passed);
      draw(colors.fail, this.failed);
      draw(colors.pending, this.pending + ' ');
      write('\n');

      cursor.up(this.numberOfLines);
    }
929124
function drawAxis() {
            svg.select('.x-axis-group.axis')
                .attr('transform', `translate(0, ${chartHeight})`)
                .call(xAxis);

            svg.select('.y-axis-group.axis')
                .call(yAxis);

            svg.selectAll('.y-axis-group .tick text')
                .call(wrapText, margin.left - yAxisPaddingBetweenChart);

            drawAxisLabels();
        }
24147
function drawLinearMinorTicks(context, options) {
    let [hasLeft, hasRight] = drawings.prepareTicks(options);
    let ticks = [];
    let i = options.minValue;
    let minTicks = Math.abs(options.minorTicks) || 0;
    let valuePerNonExactTick = minTicks ?
        (options.maxValue - options.minValue) /
        (minTicks * (options.majorTicks.length - 1)) : 0;

    if (minTicks) {
        if (options.exactTicks) {
            let delta = BaseGauge.mod(options.majorTicks[0], minTicks) || 0;

            for (; i < options.maxValue; i += minTicks) {
                if ((delta+i) < options.maxValue) {
                    ticks.push(delta + i);
                }
            }
        }

        else {
            for (; i < options.maxValue; i += valuePerNonExactTick) {
                ticks.push(i);
            }
        }
    }

    drawLinearTicks(context,
        options.colorMinorTicks || options.colorStrokeTicks,
        ticks, options.minValue, options.maxValue,
        hasLeft, hasRight, 1, options.ticksWidthMinor / 100);
}
305766
function drawChart(canvas, data) {
        var ctx = canvas.getContext('2d'),
            color = 'rgba(0, 0, 0, 0.75)',
            height = canvas.height - 2,
            width = canvas.width,
            total = data.length,
            max = Math.max.apply(Math, data),
            xstep = 1,
            ystep = max / height,
            x = 0,
            y = height - data[0] / ystep;

        ctx.clearRect(0, 0, width, height);
        ctx.beginPath();
        ctx.strokeStyle = color;
        ctx.moveTo(x, y);

        for (var i = 1; i < total; i++) {
            x += xstep;
            y = height - data[i] / ystep + 1;
            ctx.moveTo(x, height);
            ctx.lineTo(x, y);
        }

        ctx.stroke();
    }
702624
function (d, context) {
                    dimple._drawMarkers(d, chart, series, duration, className, graded, onEnter(d), onLeave(d), context);
                }
601120
function drawBullet() {
            if (rangesEl) {
                rangesEl.remove();
                measuresEl.remove();
                markersEl.remove();
            }

            rangesEl = svg.select('.chart-group')
              .selectAll('rect.range')
              .data(ranges)
              .enter()
                .append('rect')
                  .attr('fill', rangeColor)
                  .attr('opacity', (d, i) => rangeOpacityScale[i])
                  .attr('class', (d, i) => `range r${i}`)
                  .attr('width', barWidth)
                  .attr('height', chartHeight)
                  .attr('x', isReverse ? xScale : 0);

            measuresEl = svg.select('.chart-group')
              .selectAll('rect.measure')
              .data(measures)
              .enter()
                .append('rect')
                  .attr('fill', measureColor)
                  .attr('fill-opacity', (d, i) => measureOpacityScale[i])
                  .attr('class', (d, i) => `measure m${i}`)
                  .attr('width', barWidth)
                  .attr('height', getMeasureBarHeight)
                  .attr('x', isReverse ? xScale : 0)
                  .attr('y', getMeasureBarHeight);

            markersEl = svg.select('.chart-group')
              .selectAll('line.marker-line')
              .data(markers)
              .enter()
                .append('line')
                  .attr('class', 'marker-line')
                  .attr('stroke', measureColor)
                  .attr('stroke-width', markerStrokeWidth)
                  .attr('opacity', measureOpacityScale[0])
                  .attr('x1', xScale)
                  .attr('x2', xScale)
                  .attr('y1', 0)
                  .attr('y2', chartHeight);
        }
628992
function buildAxis() {
            if (isHorizontal) {
                xAxis = d3Axis.axisBottom(xScale)
                    .ticks(xTicks, valueLabelFormat);
                yAxis = d3Axis.axisLeft(yScale)
            } else {
                xAxis = d3Axis.axisBottom(xScale)
                yAxis = d3Axis.axisLeft(yScale)
                    .ticks(yTicks, valueLabelFormat)
            }
        }
631599
function DrawDashedLine($x1pix,$y1pix,$x2pix,$y2pix,$dash_length,$dash_space,$color) {
    //Code based on work by Ariel Garza and James Pine
    //I've decided to have this be in pixels only as a replacement for ImageLine
    //$x1pix = $this->xtr($x1);
    //$y1pix = $this->ytr($y1);
    //$x2pix = $this->xtr($x2);
    //$y2pix = $this->ytr($y2);

    // Get the length of the line in pixels
    $line_length = ceil (sqrt(pow(($x2pix - $x1pix),2) + pow(($y2pix - $y1pix),2)) );

    $dx = ($x2pix - $x1pix) / $line_length;
    $dy = ($y2pix - $y1pix) / $line_length;
    $lastx	= $x1pix;
    $lasty	= $y1pix;

    // Draw the dashed line
    for ($i = 0; $i < $line_length; $i += ($dash_length + $dash_space)) {
      $xpix = ($dash_length * $dx) + $lastx;
      $ypix = ($dash_length * $dy) + $lasty;

      ImageLine($this->img,$lastx,$lasty,$xpix,$ypix,$color);
      $lastx = $xpix + ($dash_space * $dx);
      $lasty = $ypix + ($dash_space * $dy);
    }
  }
1342856
function DrawXAxis() {
    //Draw Tick and Label for Y axis
    $ylab =$this->FormatYTickLabel($this->x_axis_position);
    if ($this->skip_bottom_tick != 1) {
      $this->DrawVerticalTick($ylab,$this->x_axis_position);
    }

    //Draw X Axis at Y=$x_axis_postion
    ImageLine($this->img,$this->plot_area[0]+1,$this->ytr($this->x_axis_position),
        $this->xtr($this->plot_max_x)-1,$this->ytr($this->x_axis_position),$this->ndx_tick_color);

    //X Ticks and Labels
    if ($this->data_type != 'text-data') { //labels for text-data done at data drawing time for speed.
      $this->DrawHorizontalTicks();
    }
    return true;
  }