Is Timeline.ClassicTheme.create() the same as Timeline.getDefaultTheme() ? Thanks, Nick
On Tuesday, August 23, 2011 1:57:11 PM UTC-7, mnosal wrote: > > Hi, I commented on the thread, and the advice still holds. > Don't need to fork, just override the painter method with your own. If you > make a copy of the painter functions and load after timeline-api.js has > been loaded, your modified versions will replace the originals. Keeps the > Timeline code intact, and keeps your modifications in one place, so it's > easier to deal with if/when things change. > > Or if you like, you can make your own painter from a copy of the > original-painter.js file. Call it "label_on_bar_painter.js" and tell > Timeline to use that instead of original-painter.js. > > I suspect the screenshot you reference was made with an older version of > the original painter which displayed the labels directly on top of the > event bars. You can achieve the same thing by tweaking the behavior of the > durationEventPainters (preciseDurationEventPainter and > impreciseDurationEventPainter) (and the impreciseInstantEventPainter if you > have events of that type as well). > > The changes required are to make the bars bigger: > When creating your theme: > var myTheme = Timeline.ClassicTheme.create(); > myTheme.event.tape.height = 16; // sets how thick the event tape will be > > Then in the painters, you would need to change where the label is > positioned relative to the tape: > Depending on your font-size, tape-size, and padding of your labels, you > might need to play around with the labelTop value to get things right. > Here's one that worked well for me: > > var labelTop = Math.round(metrics.trackOffset + track * > metrics.trackIncrement + (metrics.trackHeight / 2 - labelSize.height)); > > -- Mike > > > On Aug 14, 2011, at 11:56 PM, larryk wrote: > > > Hi, > > > > On the Timeline_Basics page (http://www.simile-widgets.org/wiki/ > > Timeline_Basics), the very first timeline image is an example of a > > timeline with text labels overlaid on the tape of the event - see > > "Oswald gets off bus and boards taxi". > > > > I would like to use this feature, but having scoured the docs and the > > internet, the only reference to how to do this is here: > > > http://groups.google.com/group/simile-widgets/browse_thread/thread/5a33517864ae959c > > > > The advice is to fork (!) the timeline javascript release to customize > > the event painter to adjust the labelTop. I looked at the code and > > forking it seems trivial enough, but forking in general is horrible > > and I don't want to do it. > > > > Is this really the only way to do it? How was the example image > > created? Is this a sufficiently attractive feature that it might like > > to be included as part of the official release? If not, is there any > > advice on subclassing the painters to avoid forking? > > > > Cheers, > > Larry > > -- You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/simile-widgets?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
