Pass series index to yLabelFormat

This commit is contained in:
Jelte Fennema 2014-07-15 17:55:56 +02:00
parent a9076b2cc4
commit 0192dd0eee
3 changed files with 5 additions and 5 deletions

View File

@ -241,7 +241,7 @@ class Morris.Bar extends Morris.Grid
content += """
<div class='morris-hover-point' style='color: #{@colorFor(row, j, 'label')}'>
#{@options.labels[j]}:
#{@yLabelFormat(y)}
#{@yLabelFormat(y, j)}
</div>
"""
if typeof @options.hoverCallback is 'function'

View File

@ -381,13 +381,13 @@ class Morris.Grid extends Morris.EventEmitter
# @private
#
yAxisFormat: (label) -> @yLabelFormat(label)
yAxisFormat: (label) -> @yLabelFormat(label, 0)
# @private
#
yLabelFormat: (label) ->
yLabelFormat: (label, i) ->
if typeof @options.yLabelFormat is 'function'
@options.yLabelFormat(label)
@options.yLabelFormat(label, i)
else
"#{@options.preUnits}#{Morris.commas(label)}#{@options.postUnits}"

View File

@ -115,7 +115,7 @@ class Morris.Line extends Morris.Grid
content += """
<div class='morris-hover-point' style='color: #{@colorFor(row, j, 'label')}'>
#{@options.labels[j]}:
#{@yLabelFormat(y)}
#{@yLabelFormat(y, j)}
</div>
"""
if typeof @options.hoverCallback is 'function'