Support draw more than 5 lines/series

This commit is contained in:
Mario Izquierdo (mariodebian) 2012-05-13 16:41:27 +02:00
parent d3d793919b
commit fd72af033e

View file

@ -247,9 +247,9 @@ class Morris.Line
coords = @seriesCoords[i] coords = @seriesCoords[i]
if coords.length > 1 if coords.length > 1
path = @createPath coords, @options.marginTop, @left, @options.marginTop + @height, @left + @width path = @createPath coords, @options.marginTop, @left, @options.marginTop + @height, @left + @width
@r.path(path) tmp=@r.path(path)
.attr('stroke', @options.lineColors[i]) tmp.attr('stroke', @options.lineColors[i])
.attr('stroke-width', @options.lineWidth) tmp.attr('stroke-width', @options.lineWidth)
@seriesPoints = ([] for i in [0..@seriesCoords.length-1]) @seriesPoints = ([] for i in [0..@seriesCoords.length-1])
for i in [@seriesCoords.length-1..0] for i in [@seriesCoords.length-1..0]
for c in @seriesCoords[i] for c in @seriesCoords[i]
@ -257,9 +257,9 @@ class Morris.Line
circle = null circle = null
else else
circle = @r.circle(c.x, c.y, @options.pointSize) circle = @r.circle(c.x, c.y, @options.pointSize)
.attr('fill', @options.lineColors[i]) circle.attr('fill', @options.lineColors[i])
.attr('stroke-width', 1) circle.attr('stroke-width', 1)
.attr('stroke', '#ffffff') circle.attr('stroke', '#ffffff')
@seriesPoints[i].push(circle) @seriesPoints[i].push(circle)
# create a path for a data series # create a path for a data series
@ -318,8 +318,8 @@ class Morris.Line
@yLabels = [] @yLabels = []
for i in [0..@series.length-1] for i in [0..@series.length-1]
yLabel = @r.text(0, @options.hoverFontSize * 1.5 * (i + 1.5) - @hoverHeight / 2, '') yLabel = @r.text(0, @options.hoverFontSize * 1.5 * (i + 1.5) - @hoverHeight / 2, '')
.attr('fill', @options.lineColors[i]) yLabel.attr('fill', @options.lineColors[i])
.attr('font-size', @options.hoverFontSize) yLabel.attr('font-size', @options.hoverFontSize)
@yLabels.push(yLabel) @yLabels.push(yLabel)
@hoverSet.push(yLabel) @hoverSet.push(yLabel)