prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  bar_plot_stacked example unfinished?
  **Problem Description**
  The example in https://github.com/enthought/chaco/blob/master/examples/demo/basic/bar_plot_stacked.py
  doesn't do any stacking.
  
  **Expected behavior:**
  I the bars were really stacked, I would expect the sum of all bars to reach (10+5+2) * array([1,2,3,4,5]) (the sum of all values) respectively. Instead, I am getting the following:
  ![Screen Shot 2019-05-31 at 10 19 28 AM](https://user-images.githubusercontent.com/593945/58716239-31772f80-838e-11e9-84a8-9a2588263a15.png)
  
  Looking at the code, it doesn't use the bar plot's `starting_value` as expected, so the demo doesn't even seem to try to do the right thing.
  
  
  </issue>
  <code>
  [start of examples/demo/basic/bar_plot_stacked.py]
  1 """
  2 Simple example of a stacked bar chart
  3 """
  4 
  5 # Major library imports
  6 import numpy
  7 
  8 # Enthought library imports
  9 from enable.api import ComponentEditor
  10 from traits.api import HasTraits, Instance
  11 from traitsui.api import UItem, View
  12 
  13 # Chaco imports
  14 from chaco.api import LabelAxis, Plot, ArrayPlotData
  15 
  16 class PlotExample(HasTraits):
  17     plot = Instance(Plot)
  18     traits_view = View(UItem('plot', editor=ComponentEditor()),
  19                        width=400, height=400, resizable=True, 
  20                       )
  21 
  22     def __init__(self, index, series_a, series_b, series_c, **kw):
  23         super(PlotExample, self).__init__(**kw)
  24 
  25         plot_data = ArrayPlotData(index=index)
  26         plot_data.set_data('series_a', series_a)
  27         plot_data.set_data('series_b', series_b)
  28         plot_data.set_data('series_c', series_c)
  29         self.plot = Plot(plot_data)
  30         self.plot.plot(('index', 'series_a'), type='bar', bar_width=0.8, color='auto')
  31         self.plot.plot(('index', 'series_b'), type='bar', bar_width=0.8, color='auto')
  32         self.plot.plot(('index', 'series_c'), type='bar', bar_width=0.8, color='auto')
  33 
  34         # set the plot's value range to 0, otherwise it may pad too much
  35         self.plot.value_range.low = 0
  36 
  37         # replace the index values with some nicer labels
  38         label_axis = LabelAxis(self.plot, orientation='bottom',
  39                                title='Months',
  40                                positions = list(range(1, 10)),
  41                                labels = ['jan', 'feb', 'march', 'april', 'may'],
  42                                small_haxis_style=True)
  43 
  44         self.plot.underlays.remove(self.plot.index_axis)
  45         self.plot.index_axis = label_axis
  46         self.plot.underlays.append(label_axis)
  47 
  48 
  49 index = numpy.array([1,2,3,4,5])
  50 demo = PlotExample(index, index*10, index*5, index*2)
  51 
  52 if __name__ == "__main__":
  53     demo.configure_traits()
  54
  [end of examples/demo/basic/bar_plot_stacked.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/demo/basic/bar_plot_stacked.py b/examples/demo/basic/bar_plot_stacked.py
  --- a/examples/demo/basic/bar_plot_stacked.py
  +++ b/examples/demo/basic/bar_plot_stacked.py
  @@ -11,7 +11,7 @@
   from traitsui.api import UItem, View
   
   # Chaco imports
  -from chaco.api import LabelAxis, Plot, ArrayPlotData
  +from chaco.api import LabelAxis, Plot, ArrayPlotData, ArrayDataSource
   
   class PlotExample(HasTraits):
       plot = Instance(Plot)
  @@ -22,14 +22,18 @@
       def __init__(self, index, series_a, series_b, series_c, **kw):
           super(PlotExample, self).__init__(**kw)
   
  +        # Stack them up
  +        series_c = series_c + series_b + series_a
  +        series_b = series_b + series_a
  +
           plot_data = ArrayPlotData(index=index)
           plot_data.set_data('series_a', series_a)
           plot_data.set_data('series_b', series_b)
           plot_data.set_data('series_c', series_c)
           self.plot = Plot(plot_data)
           self.plot.plot(('index', 'series_a'), type='bar', bar_width=0.8, color='auto')
  -        self.plot.plot(('index', 'series_b'), type='bar', bar_width=0.8, color='auto')
  -        self.plot.plot(('index', 'series_c'), type='bar', bar_width=0.8, color='auto')
  +        self.plot.plot(('index', 'series_b'), type='bar', bar_width=0.8, color='auto', starting_value=ArrayDataSource(series_a))
  +        self.plot.plot(('index', 'series_c'), type='bar', bar_width=0.8, color='auto', starting_value=ArrayDataSource(series_b))
   
           # set the plot's value range to 0, otherwise it may pad too much
           self.plot.value_range.low = 0
  
verification_info: {"golden_diff": "diff --git a/examples/demo/basic/bar_plot_stacked.py b/examples/demo/basic/bar_plot_stacked.py\n--- a/examples/demo/basic/bar_plot_stacked.py\n+++ b/examples/demo/basic/bar_plot_stacked.py\n@@ -11,7 +11,7 @@\n from traitsui.api import UItem, View\n \n # Chaco imports\n-from chaco.api import LabelAxis, Plot, ArrayPlotData\n+from chaco.api import LabelAxis, Plot, ArrayPlotData, ArrayDataSource\n \n class PlotExample(HasTraits):\n     plot = Instance(Plot)\n@@ -22,14 +22,18 @@\n     def __init__(self, index, series_a, series_b, series_c, **kw):\n         super(PlotExample, self).__init__(**kw)\n \n+        # Stack them up\n+        series_c = series_c + series_b + series_a\n+        series_b = series_b + series_a\n+\n         plot_data = ArrayPlotData(index=index)\n         plot_data.set_data('series_a', series_a)\n         plot_data.set_data('series_b', series_b)\n         plot_data.set_data('series_c', series_c)\n         self.plot = Plot(plot_data)\n         self.plot.plot(('index', 'series_a'), type='bar', bar_width=0.8, color='auto')\n-        self.plot.plot(('index', 'series_b'), type='bar', bar_width=0.8, color='auto')\n-        self.plot.plot(('index', 'series_c'), type='bar', bar_width=0.8, color='auto')\n+        self.plot.plot(('index', 'series_b'), type='bar', bar_width=0.8, color='auto', starting_value=ArrayDataSource(series_a))\n+        self.plot.plot(('index', 'series_c'), type='bar', bar_width=0.8, color='auto', starting_value=ArrayDataSource(series_b))\n \n         # set the plot's value range to 0, otherwise it may pad too much\n         self.plot.value_range.low = 0\n", "issue": "bar_plot_stacked example unfinished?\n**Problem Description**\r\nThe example in https://github.com/enthought/chaco/blob/master/examples/demo/basic/bar_plot_stacked.py\r\ndoesn't do any stacking.\r\n\r\n**Expected behavior:**\r\nI the bars were really stacked, I would expect the sum of all bars to reach (10+5+2) * array([1,2,3,4,5]) (the sum of all values) respectively. Instead, I am getting the following:\r\n![Screen Shot 2019-05-31 at 10 19 28 AM](https://user-images.githubusercontent.com/593945/58716239-31772f80-838e-11e9-84a8-9a2588263a15.png)\r\n\r\nLooking at the code, it doesn't use the bar plot's `starting_value` as expected, so the demo doesn't even seem to try to do the right thing.\r\n\n", "before_files": [{"content": "\"\"\"\nSimple example of a stacked bar chart\n\"\"\"\n\n# Major library imports\nimport numpy\n\n# Enthought library imports\nfrom enable.api import ComponentEditor\nfrom traits.api import HasTraits, Instance\nfrom traitsui.api import UItem, View\n\n# Chaco imports\nfrom chaco.api import LabelAxis, Plot, ArrayPlotData\n\nclass PlotExample(HasTraits):\n    plot = Instance(Plot)\n    traits_view = View(UItem('plot', editor=ComponentEditor()),\n                       width=400, height=400, resizable=True, \n                      )\n\n    def __init__(self, index, series_a, series_b, series_c, **kw):\n        super(PlotExample, self).__init__(**kw)\n\n        plot_data = ArrayPlotData(index=index)\n        plot_data.set_data('series_a', series_a)\n        plot_data.set_data('series_b', series_b)\n        plot_data.set_data('series_c', series_c)\n        self.plot = Plot(plot_data)\n        self.plot.plot(('index', 'series_a'), type='bar', bar_width=0.8, color='auto')\n        self.plot.plot(('index', 'series_b'), type='bar', bar_width=0.8, color='auto')\n        self.plot.plot(('index', 'series_c'), type='bar', bar_width=0.8, color='auto')\n\n        # set the plot's value range to 0, otherwise it may pad too much\n        self.plot.value_range.low = 0\n\n        # replace the index values with some nicer labels\n        label_axis = LabelAxis(self.plot, orientation='bottom',\n                               title='Months',\n                               positions = list(range(1, 10)),\n                               labels = ['jan', 'feb', 'march', 'april', 'may'],\n                               small_haxis_style=True)\n\n        self.plot.underlays.remove(self.plot.index_axis)\n        self.plot.index_axis = label_axis\n        self.plot.underlays.append(label_axis)\n\n\nindex = numpy.array([1,2,3,4,5])\ndemo = PlotExample(index, index*10, index*5, index*2)\n\nif __name__ == \"__main__\":\n    demo.configure_traits()\n", "path": "examples/demo/basic/bar_plot_stacked.py"}]}