mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-10 21:36:34 +01:00
Src attribute of a row gets passed to the barColors function as well
This commit is contained in:
parent
a9076b2cc4
commit
1074ec41d3
@ -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
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user