Created
December 20, 2012 11:48
-
-
Save fmsf/4344860 to your computer and use it in GitHub Desktop.
Must remember to push this to flot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// draw ticks | |
for (i = 0; i < axis.ticks.length; ++i) { | |
ctx.beginPath(); | |
var v = axis.ticks[i].v; | |
xoff = yoff = 0; | |
if (v < axis.min || v > axis.max | |
// skip those lying on the axes if we got a border | |
|| (t == "full" && bw > 0 | |
&& (v == axis.min || v == axis.max))) | |
continue; | |
if (axis.direction == "x") { | |
x = axis.p2c(v); | |
yoff = t == "full" ? -plotHeight : t; | |
if (axis.position == "top") | |
yoff = -yoff; | |
} | |
else { | |
y = axis.p2c(v); | |
xoff = t == "full" ? -plotWidth : t; | |
if (axis.position == "left") | |
xoff = -xoff; | |
} | |
if (ctx.lineWidth == 1) { | |
if (axis.direction == "x") | |
x = Math.floor(x) + 0.5; | |
else | |
y = Math.floor(y) + 0.5; | |
} | |
if ($.isFunction(axis.options.tickColor)){ | |
ctx.strokeStyle = axis.options.tickColor(v); | |
} | |
ctx.moveTo(x, y); | |
ctx.lineTo(x + xoff, y + yoff); | |
ctx.stroke(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
added to pull request: flot/flot#917