prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Checkbox example is not working as expected
  The new checkbox example in master (examples/plotting/file/line_on_off.py) is not working as expected, the plotted lines are depend on how many checkbox are ticked and not on which one. The reason is that the js code is not checking for the values but for the existence of the index.
  
  I have a fix for this with a PR coming, and opening this only as an associated issue.
  
  
  </issue>
  <code>
  [start of examples/plotting/file/line_on_off.py]
  1 """ Example demonstrating turning lines on and off - with JS only
  2 
  3 """
  4 
  5 import numpy as np
  6 
  7 from bokeh.io import output_file, show
  8 from bokeh.layouts import row
  9 from bokeh.palettes import Viridis3
  10 from bokeh.plotting import figure
  11 from bokeh.models import CheckboxGroup, CustomJS
  12 
  13 output_file("line_on_off.html", title="line_on_off.py example")
  14 
  15 code = """
  16     if (0 in checkbox.active) {
  17         l0.visible = true
  18     } else {
  19         l0.visible = false
  20     }
  21     if (1 in checkbox.active) {
  22         l1.visible = true
  23     } else {
  24         l1.visible = false
  25     }
  26     if (2 in checkbox.active) {
  27         l2.visible = true
  28     } else {
  29         l2.visible = false
  30     }
  31 """
  32 
  33 p = figure()
  34 props = dict(line_width=4, line_alpha=0.7)
  35 x = np.linspace(0, 4 * np.pi, 100)
  36 l0 = p.line(x, np.sin(x), color=Viridis3[0], legend="Line 0", **props)
  37 l1 = p.line(x, 4 * np.cos(x), color=Viridis3[1], legend="Line 1", **props)
  38 l2 = p.line(x, np.tan(x), color=Viridis3[2], legend="Line 2", **props)
  39 
  40 callback = CustomJS(code=code, args={})
  41 checkbox = CheckboxGroup(labels=["Line 0", "Line 1", "Line 2"], active=[0, 1, 2], callback=callback, width=100)
  42 callback.args = dict(l0=l0, l1=l1, l2=l2, checkbox=checkbox)
  43 
  44 layout = row(checkbox, p)
  45 show(layout)
  46
  [end of examples/plotting/file/line_on_off.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/examples/plotting/file/line_on_off.py b/examples/plotting/file/line_on_off.py
  --- a/examples/plotting/file/line_on_off.py
  +++ b/examples/plotting/file/line_on_off.py
  @@ -12,24 +12,6 @@
   
   output_file("line_on_off.html", title="line_on_off.py example")
   
  -code = """
  -    if (0 in checkbox.active) {
  -        l0.visible = true
  -    } else {
  -        l0.visible = false
  -    }
  -    if (1 in checkbox.active) {
  -        l1.visible = true
  -    } else {
  -        l1.visible = false
  -    }
  -    if (2 in checkbox.active) {
  -        l2.visible = true
  -    } else {
  -        l2.visible = false
  -    }
  -"""
  -
   p = figure()
   props = dict(line_width=4, line_alpha=0.7)
   x = np.linspace(0, 4 * np.pi, 100)
  @@ -37,9 +19,14 @@
   l1 = p.line(x, 4 * np.cos(x), color=Viridis3[1], legend="Line 1", **props)
   l2 = p.line(x, np.tan(x), color=Viridis3[2], legend="Line 2", **props)
   
  -callback = CustomJS(code=code, args={})
  -checkbox = CheckboxGroup(labels=["Line 0", "Line 1", "Line 2"], active=[0, 1, 2], callback=callback, width=100)
  -callback.args = dict(l0=l0, l1=l1, l2=l2, checkbox=checkbox)
  +checkbox = CheckboxGroup(labels=["Line 0", "Line 1", "Line 2"],
  +                         active=[0, 1, 2], width=100)
  +checkbox.callback = CustomJS(args=dict(l0=l0, l1=l1, l2=l2, checkbox=checkbox),
  +                             lang="coffeescript", code="""
  +l0.visible = 0 in checkbox.active;
  +l1.visible = 1 in checkbox.active;
  +l2.visible = 2 in checkbox.active;
  +""")
   
   layout = row(checkbox, p)
   show(layout)
  
verification_info: {"golden_diff": "diff --git a/examples/plotting/file/line_on_off.py b/examples/plotting/file/line_on_off.py\n--- a/examples/plotting/file/line_on_off.py\n+++ b/examples/plotting/file/line_on_off.py\n@@ -12,24 +12,6 @@\n \n output_file(\"line_on_off.html\", title=\"line_on_off.py example\")\n \n-code = \"\"\"\n-    if (0 in checkbox.active) {\n-        l0.visible = true\n-    } else {\n-        l0.visible = false\n-    }\n-    if (1 in checkbox.active) {\n-        l1.visible = true\n-    } else {\n-        l1.visible = false\n-    }\n-    if (2 in checkbox.active) {\n-        l2.visible = true\n-    } else {\n-        l2.visible = false\n-    }\n-\"\"\"\n-\n p = figure()\n props = dict(line_width=4, line_alpha=0.7)\n x = np.linspace(0, 4 * np.pi, 100)\n@@ -37,9 +19,14 @@\n l1 = p.line(x, 4 * np.cos(x), color=Viridis3[1], legend=\"Line 1\", **props)\n l2 = p.line(x, np.tan(x), color=Viridis3[2], legend=\"Line 2\", **props)\n \n-callback = CustomJS(code=code, args={})\n-checkbox = CheckboxGroup(labels=[\"Line 0\", \"Line 1\", \"Line 2\"], active=[0, 1, 2], callback=callback, width=100)\n-callback.args = dict(l0=l0, l1=l1, l2=l2, checkbox=checkbox)\n+checkbox = CheckboxGroup(labels=[\"Line 0\", \"Line 1\", \"Line 2\"],\n+                         active=[0, 1, 2], width=100)\n+checkbox.callback = CustomJS(args=dict(l0=l0, l1=l1, l2=l2, checkbox=checkbox),\n+                             lang=\"coffeescript\", code=\"\"\"\n+l0.visible = 0 in checkbox.active;\n+l1.visible = 1 in checkbox.active;\n+l2.visible = 2 in checkbox.active;\n+\"\"\")\n \n layout = row(checkbox, p)\n show(layout)\n", "issue": "Checkbox example is not working as expected\nThe new checkbox example in master (examples/plotting/file/line_on_off.py) is not working as expected, the plotted lines are depend on how many checkbox are ticked and not on which one. The reason is that the js code is not checking for the values but for the existence of the index.\n\nI have a fix for this with a PR coming, and opening this only as an associated issue.\n\n", "before_files": [{"content": "\"\"\" Example demonstrating turning lines on and off - with JS only\n\n\"\"\"\n\nimport numpy as np\n\nfrom bokeh.io import output_file, show\nfrom bokeh.layouts import row\nfrom bokeh.palettes import Viridis3\nfrom bokeh.plotting import figure\nfrom bokeh.models import CheckboxGroup, CustomJS\n\noutput_file(\"line_on_off.html\", title=\"line_on_off.py example\")\n\ncode = \"\"\"\n    if (0 in checkbox.active) {\n        l0.visible = true\n    } else {\n        l0.visible = false\n    }\n    if (1 in checkbox.active) {\n        l1.visible = true\n    } else {\n        l1.visible = false\n    }\n    if (2 in checkbox.active) {\n        l2.visible = true\n    } else {\n        l2.visible = false\n    }\n\"\"\"\n\np = figure()\nprops = dict(line_width=4, line_alpha=0.7)\nx = np.linspace(0, 4 * np.pi, 100)\nl0 = p.line(x, np.sin(x), color=Viridis3[0], legend=\"Line 0\", **props)\nl1 = p.line(x, 4 * np.cos(x), color=Viridis3[1], legend=\"Line 1\", **props)\nl2 = p.line(x, np.tan(x), color=Viridis3[2], legend=\"Line 2\", **props)\n\ncallback = CustomJS(code=code, args={})\ncheckbox = CheckboxGroup(labels=[\"Line 0\", \"Line 1\", \"Line 2\"], active=[0, 1, 2], callback=callback, width=100)\ncallback.args = dict(l0=l0, l1=l1, l2=l2, checkbox=checkbox)\n\nlayout = row(checkbox, p)\nshow(layout)\n", "path": "examples/plotting/file/line_on_off.py"}]}