diff --git a/lib/morris.bar.coffee b/lib/morris.bar.coffee index fba8037..2b5debb 100644 --- a/lib/morris.bar.coffee +++ b/lib/morris.bar.coffee @@ -188,7 +188,7 @@ class Morris.Bar extends Morris.Grid # @param type [String] "bar", "hover" or "label" colorFor: (row, sidx, type) -> if typeof @options.barColors is 'function' - r = { x: row.x, y: row.y[sidx], label: row.label } + r = { x: row.x, y: row.y[sidx], label: row.label, src: row.src} s = { index: sidx, key: @options.ykeys[sidx], label: @options.labels[sidx] } @options.barColors.call(@, r, s, type) else diff --git a/spec/lib/bar/colours.coffee b/spec/lib/bar/colours.coffee index ebe5469..636df48 100644 --- a/spec/lib/bar/colours.coffee +++ b/spec/lib/bar/colours.coffee @@ -25,12 +25,12 @@ describe 'Morris.Bar#colorFor', -> chart.colorFor(chart.data[0], 0, 'bar') stub.should.have.been.calledWith( - {x:0, y:2, label:'foo'}, + {x:0, y:2, label:'foo', src: { x: "foo", y: 2, z: 3 }}, {index:0, key:'y', label:'Y'}, 'bar') chart.colorFor(chart.data[0], 1, 'hover') stub.should.have.been.calledWith( - {x:0, y:3, label:'foo'}, + {x:0, y:3, label:'foo', src: { x: "foo", y: 2, z: 3 }}, {index:1, key:'z', label:'Z'}, 'hover')