<commit_before>import {Axis} from "../axes/axis"
import {GuideRenderer, GuideRendererView} from "../renderers/guide_renderer"
import {Range} from "../ranges/range"
import {Ticker} from "../tickers/ticker"
import {Line, Fill} from "core/visuals"
import {Color} from "core/types"
import {LineJoin, LineCap} from "core/enums"
import * as p from "core/properties"
import {Context2d} from "core/util/canvas"
import {isArray} from "core/util/types"

export class GridView extends GuideRendererView {
  model: Grid
  visuals: Grid.Visuals

  protected get _x_range_name(): string {
    return this.model.x_range_name
  }

  protected get _y_range_name(): string {
    return this.model.y_range_name
  }

  render(): void {
    if (!this.model.visible)
      return

    const ctx = this.plot_view.canvas_view.ctx
    ctx.save()
    this._draw_regions(ctx)
    this._draw_minor_grids(ctx)
    this._draw_grids(ctx)
    ctx.restore()
  }

  connect_signals(): void {
    super.connect_signals()
    this.connect(this.model.change, () => this.request_render())
  }

  protected _draw_regions(ctx: Context2d): void {
    if (!this.visuals.band_fill.doit)
      return
    const [xs, ys] = this.model.grid_coords('major', false)
    this.visuals.band_fill.set_value(ctx)
    for (let i = 0; i < xs.length-1; i++) {
      if (i % 2 == 1) {
        const [sx0, sy0] = this.plot_view.map_to_screen(xs[i],   ys[i],   this._x_range_name, this._y_range_name)
        const [sx1, sy1] = this.plot_view.map_to_screen(xs[i+1], ys[i+1], this._x_range_name, this._y_range_name)
        ctx.fillRect(sx0[0], sy0[0], sx1[1] - sx0[0], sy1[1] - sy0[0])
        ctx.fill()
      }
    }
  }

  protected _draw_grids(ctx: Context2d): void {
    if (!this.visuals.grid_line.doit)
      return
    const [xs, ys] = this.model.grid_coords('major')
    this._draw_grid_helper(ctx, this.visuals.grid_line, xs, ys)
  }<commit_msg>remove extraneous ctx.fill for bands (#8602)<commit_after>import {Axis} from "../axes/axis"
import {GuideRenderer, GuideRendererView} from "../renderers/guide_renderer"
import {Range} from "../ranges/range"
import {Ticker} from "../tickers/ticker"
import {Line, Fill} from "core/visuals"
import {Color} from "core/types"
import {LineJoin, LineCap} from "core/enums"
import * as p from "core/properties"
import {Context2d} from "core/util/canvas"
import {isArray} from "core/util/types"

export class GridView extends GuideRendererView {
  model: Grid
  visuals: Grid.Visuals

  protected get _x_range_name(): string {
    return this.model.x_range_name
  }

  protected get _y_range_name(): string {
    return this.model.y_range_name
  }

  render(): void {
    if (!this.model.visible)
      return

    const ctx = this.plot_view.canvas_view.ctx
    ctx.save()
    this._draw_regions(ctx)
    this._draw_minor_grids(ctx)
    this._draw_grids(ctx)
    ctx.restore()
  }

  connect_signals(): void {
    super.connect_signals()
    this.connect(this.model.change, () => this.request_render())
  }

  protected _draw_regions(ctx: Context2d): void {
    if (!this.visuals.band_fill.doit)
      return
    const [xs, ys] = this.model.grid_coords('major', false)
    this.visuals.band_fill.set_value(ctx)
    for (let i = 0; i < xs.length-1; i++) {
      if (i % 2 == 1) {
        const [sx0, sy0] = this.plot_view.map_to_screen(xs[i],   ys[i],   this._x_range_name, this._y_range_name)
        const [sx1, sy1] = this.plot_view.map_to_screen(xs[i+1], ys[i+1], this._x_range_name, this._y_range_name)
        ctx.fillRect(sx0[0], sy0[0], sx1[1] - sx0[0], sy1[1] - sy0[0])
      }
    }
  }

  protected _draw_grids(ctx: Context2d): void {
    if (!this.visuals.grid_line.doit)
      return
    const [xs, ys] = this.model.grid_coords('major')
    this._draw_grid_helper(ctx, this.visuals.grid_line, xs, ys)
  }
{'fraction_non_alphanumeric': 0.14387164650184114, 'fraction_numerical': 0.014203051025775907, 'mean_word_length': 3.489964580873672, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6628859', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1403, 'n_words': 290}