mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-13 07:11:12 +01:00
Merge pull request #459 from JelteF/better-ylabel-callback
Pass series index to yLabelFormat
This commit is contained in:
commit
bb86c78613
3 changed files with 5 additions and 5 deletions
|
@ -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'
|
||||
|
|
|
@ -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}"
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue