You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Flot graphs
Hi,
I've an X-axis in DateTime format and I want to place ticks with
labels only at the min and the max values left an right. Setting the
number of ticks to 2 I got some misaligned ticks at uneuqal distances.
Setting count to 1 I didn't get a tick at the most centered position
between min and max.
So, what parameters do I have to tweak to get min/max ticks? Hope for
a solution without writing the complete tick-algorithm on my own.
Thanks
Konrad
Michael Wood
unread,
Sep 21, 2011, 8:12:10 AM9/21/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to flot-...@googlegroups.com
Something like this:
var mintick = 10000, maxtick = 50000;
... xaxis: { ... ticks: [mintick, maxtick], ... }
or:
ticks: [[mintick, "This is min"], [maxtick, "This is max"]]
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to flot-...@googlegroups.com
I think Michael's solution requires that you know the min, max up front
What I did was to create a tickFormatter for the axis that returns blank for all the values except for the first and last one. This means you need to find a way for the tickFormatter function to have access to the axis object so you can determine the max and min for the current data.
-- Juan Mendes
Juan Mendes
unread,
Sep 29, 2011, 2:41:22 PM9/29/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to flot-...@googlegroups.com
Oops, the axis is already the second argument to the tickFormatter, so it should be really simple
tickFormatter: function(val, axis) {
if (val == axis.ticks[0]) {
return $.plot.formatDate(val, axis.timeFormat);
}
// The following statement may not work correctly
if (val == axis.ticks[axis.ticks.length - 1]) {
return $.plot.formatDate(val, axis.timeFormat);
}
}
May need some fudging but should be more than halfway there
-- Juan Mendes
Juan Mendes
unread,
Sep 29, 2011, 5:27:21 PM9/29/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to flot-...@googlegroups.com
What I suggested is not going to work,
The ticks array is not fully populated when tickFormatter is called, there's no way to know when it's the last tick.
I looked back at how I got this working and it ended up being a hook on draw, that simply removed the unwanted ticks from the DOM, since they are implemented in HTML.
-- Juan Mendes
Vivek Warpe
unread,
Sep 30, 2011, 4:54:20 AM9/30/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message