Ticker labeling

145 views
Skip to first unread message

wilk...@clarkson.edu

unread,
May 25, 2017, 4:03:40 PM5/25/17
to dygraphs-users
I'm trying to put a time series into a dygraph. I have the axisLabelFormatter working, which displays the MM/DD/yyyy HH:mm:ss on each tick. I set the ticker function to have a granularity of Dygraph.TWO_MINUTELY, which correctly sets the ticks in two minute intervals.  

Here's my code for the ticker function and axisLabelFormatter:

ticker: function (a, b, pixels, opts, dygraph, vals) {
   
return Dygraph.getDateAxis(a, b, Dygraph.TWO_MINUTELY, opts, dygraph);
axisLabelFormatter: function(date,gran,opts){

axisLabelFormatter: function(date,gran,opts){
       
return Dygraph.dateAxisLabelFormatter(date,gran,opts);
}


Is there a way to only label some of the ticks, not all of them? I have found examples of the ticker function manually labeling each tick with a function like this: 

ticker
: function(min, max, pixels) {
 
return [
   
{ v: 0*24 + 24 },
   
{ label_v: 0*24 + 12, label: 'Sun' },
   
{ v: 1*24 + 24 },
   
{ label_v: 1*24 + 12, label: 'Mon' }
]
}

It would be nice to have the dygraph only label the first and last ticks, with the start and end dates (and possibly the middle tick). Is this possible without having to set values and labels for each tick?

Dan Vanderkam

unread,
May 25, 2017, 10:32:18 PM5/25/17
to dygraph...@googlegroups.com
try calling the default formatter and modifying its results to your liking?

--
You received this message because you are subscribed to the Google Groups "dygraphs-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dygraphs-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages