You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem:
Currently a custom tick tickFormatter is passed a value and an axis object.
The axis object doe not provide any information on which axis it is. So for
example a graph could have two series, on is altitude in meters and the
other is speed in km/hr. In the custom formater there is no way to add the
correct unit to the tick.
Recommendation: The axis objects need to have a 'key' that identifies them.
I have a simple fix:
Existing code:
...
canvas = null, // the canvas for the plot itself
overlay = null, // canvas for interactive stuff on top of plot
eventHolder = null, // jQuery object that events should be bound to
ctx = null, octx = null,
target = $(target_),
-> axes = { xaxis: {}, yaxis: {}, x2axis: {}, y2axis: {} },
plotOffset = { left: 0, right: 0, top: 0, bottom: 0},
canvasWidth = 0, canvasHeight = 0,
plotWidth = 0, plotHeight = 0,
...
From olau%iol...@gtempaccount.com on October 07, 2009 15:31:56
Hm, yes, something like that.
A complication is that some people want to add more axes than just the two possible
right now. This is a bit difficult because most of the critical places in Flot are
not prepared for dealing with more than two. We need to generalize that, and fix this
problem too.
Original author: b1gg...@gmail.com (July 17, 2009 18:26:21)
Problem:
Currently a custom tick tickFormatter is passed a value and an axis object.
The axis object doe not provide any information on which axis it is. So for
example a graph could have two series, on is altitude in meters and the
other is speed in km/hr. In the custom formater there is no way to add the
correct unit to the tick.
Recommendation: The axis objects need to have a 'key' that identifies them.
I have a simple fix:
Existing code:
...
canvas = null, // the canvas for the plot itself
overlay = null, // canvas for interactive stuff on top of plot
eventHolder = null, // jQuery object that events should be bound to
ctx = null, octx = null,
target = $(target_),
-> axes = { xaxis: {}, yaxis: {}, x2axis: {}, y2axis: {} },
plotOffset = { left: 0, right: 0, top: 0, bottom: 0},
canvasWidth = 0, canvasHeight = 0,
plotWidth = 0, plotHeight = 0,
...
Proposed change:
...
canvas = null, // the canvas for the plot itself
overlay = null, // canvas for interactive stuff on top of plot
eventHolder = null, // jQuery object that events should be bound to
ctx = null, octx = null,
target = $(target_),
-> axes = {
-> xaxis: {
-> axisName: 'x',
-> axisIndex: 0},
-> yaxis: {
-> axisName: 'y',
-> axisIndex: 0},
-> x2axis: {
-> axisName: 'x',
-> axisIndex: 1},
-> y2axis: {
-> axisName: 'y',
-> axisIndex: 1}
-> },
plotOffset = { left: 0, right: 0, top: 0, bottom: 0},
canvasWidth = 0, canvasHeight = 0,
plotWidth = 0, plotHeight = 0,
...
This would allow a tickFormetter like this:
options.yaxis.tickFormatter = function(val,axis){
var unit_labels = new Array('meters','km/hr');
return (val|0) + " " + unit_labels[axis.axisIndex];
}
Original issue: http://code.google.com/p/flot/issues/detail?id=193
The text was updated successfully, but these errors were encountered: