mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-14 07:41:11 +01:00
Fix blurry lines
This commit is contained in:
parent
a9076b2cc4
commit
bc76a22ec3
1 changed files with 7 additions and 4 deletions
|
@ -417,6 +417,7 @@ class Morris.Grid extends Morris.EventEmitter
|
||||||
@drawXAxisLabel(pos, basePos, @yAxisFormat(lineY))
|
@drawXAxisLabel(pos, basePos, @yAxisFormat(lineY))
|
||||||
|
|
||||||
if @options.grid
|
if @options.grid
|
||||||
|
pos = Math.floor(pos) + 0.5
|
||||||
if not @options.horizontal
|
if not @options.horizontal
|
||||||
@drawGridLine("M#{@xStart},#{pos}H#{@xEnd}")
|
@drawGridLine("M#{@xStart},#{pos}H#{@xEnd}")
|
||||||
else
|
else
|
||||||
|
@ -436,20 +437,22 @@ class Morris.Grid extends Morris.EventEmitter
|
||||||
@drawEvent(event, color)
|
@drawEvent(event, color)
|
||||||
|
|
||||||
drawGoal: (goal, color) ->
|
drawGoal: (goal, color) ->
|
||||||
|
y = Math.floor(@transY(goal)) + 0.5
|
||||||
if not @options.horizontal
|
if not @options.horizontal
|
||||||
path = "M#{@xStart},#{@transY(goal)}H#{@xEnd}"
|
path = "M#{@xStart},#{y}H#{@xEnd}"
|
||||||
else
|
else
|
||||||
path = "M#{@transY(goal)},#{@xStart}V#{@xEnd}"
|
path = "M#{y},#{@xStart}V#{@xEnd}"
|
||||||
|
|
||||||
@raphael.path(path)
|
@raphael.path(path)
|
||||||
.attr('stroke', color)
|
.attr('stroke', color)
|
||||||
.attr('stroke-width', @options.goalStrokeWidth)
|
.attr('stroke-width', @options.goalStrokeWidth)
|
||||||
|
|
||||||
drawEvent: (event, color) ->
|
drawEvent: (event, color) ->
|
||||||
|
x = Math.floor(@transX(goal)) + 0.5
|
||||||
if not @options.horizontal
|
if not @options.horizontal
|
||||||
path = "M#{@transX(goal)},#{@yStart}V#{@yEnd}"
|
path = "M#{x},#{@yStart}V#{@yEnd}"
|
||||||
else
|
else
|
||||||
path = "M#{@yStart},#{@transX(goal)}H#{@yEnd}"
|
path = "M#{@yStart},#{x}H#{@yEnd}"
|
||||||
|
|
||||||
@raphael.path(path)
|
@raphael.path(path)
|
||||||
.attr('stroke', color)
|
.attr('stroke', color)
|
||||||
|
|
Loading…
Reference in a new issue