Hi ! Ok, I see. Much, much thanks again. You seems to be a real expert on this!
br--mabra On Aug 7, 7:28 pm, Michael Nosal <[email protected]> wrote: > I was referring to original-painter.js. In v2.3.0, the > _paintEventLabel method is at line 490: > Timeline.OriginalEventPainter.prototype._paintEventLabel = > function(evt, text, left, top, width, > height, theme, labelDivClassName, highlightIndex) { > var doc = this._timeline.getDocument(); > > var labelDiv = doc.createElement("div"); > labelDiv.className = labelDivClassName; > labelDiv.id = this._encodeEventElID('label', evt); > labelDiv.style.left = left + "px"; > labelDiv.style.width = width + "px"; > labelDiv.style.top = top + "px"; > labelDiv.innerHTML = text; > > if(evt._title != null) > labelDiv.title = evt._title; > > var color = evt.getTextColor(); > if (color == null) { > color = evt.getColor(); > } > if (color != null) { > labelDiv.style.color = color; > } > if (theme.event.highlightLabelBackground && highlightIndex >= 0) { > labelDiv.style.background = > this._getHighlightColor(highlightIndex, theme); > } > > this._eventLayer.appendChild(labelDiv); > > return { > left: left, > top: top, > width: width, > height: height, > elmt: labelDiv > };}; > > Line 500: > labelDiv.innerHTML = text; > is how the text gets on the timeline. Inside this function, evt is the > variable that holds the actual Event object that is responsible for > the item being shown on the timeline. "this" would refer to the > instance of the OriginalEventPainter that is doing the drawing, not > the Event object. So you want to call evt.getProperty("propertyName") > to add additional text to the label. > There are several different approaches one can take to customize how > Timeline works. In the case of relatively small modifications like > this, it is easiest to simply copy the entire ._paintEventLabel > function code into a new file, and make your changes to that copy. As > long as your copy of the function is loaded after Timeline has been > loaded, then it will replace (override) the default Timeline behavior. > Good luck. > --Mike Nosal > On Aug 7, 2009, at 1:10 PM, mabra wrote: > > > > > ... > > Thanks to your last explanation, I got a picture of the painters. The > > idea, to show more inside the band, may be - sometimes - a good one. > > But I see other code in the "original" [I use 2.3.0], than that, that > > you posted. > > > In that code, I should do: > > B.innerHTML=L + "(" + this.getProperty("rating") + ")"; > > > assuming that "this", inside the function, is a reference to the > > event. > > Additionally, I have to override the prototype!?? > > Am I right??- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/simile-widgets?hl=en -~----------~----~----~----~------~----~------~--~---
