Hi Grolandais,

Instead of setting 
    theme.event.bubble.height = 150;
use this:
    theme.event.bubble.maxHeight = 150;

You should then get a scrollbar on the bubble if the height is more than 200.

Larry





________________________________
From: grolandais <[email protected]>
To: SIMILE Widgets <[email protected]>
Sent: Friday, May 8, 2009 4:43:28 PM
Subject: [Timeline] How to put more datas in bubbles?


Hi!
First, please excuse me for my English level. I'll try to be as clear
as possible.

My problem is that when i put a text into a bubble, if the text is too
long , it is truncated.
I know how to change width or length but how can i increase the size
of the content of the bubble?

I can't show you a live web page where the problem can be seen because
the server is only on a intranet lan.


At the begin of my code, i have this part of js:
<script>
        Timeline.DefaultEventSource.Event.prototype.fillInfoBubble =
            function(elmt, theme, labeller) {
                var doc = elmt.ownerDocument;

        var title = this.getText();
        var link = this.getLink();
        var image = this.getImage();

        if (image != null) {
            var img = doc.createElement("img");
            img.src = image;

            theme.event.bubble.imageStyler(img);
            elmt.appendChild(img);
        }

        var divTitle = doc.createElement("div");
        var textTitle = doc.createTextNode(title);
        if (link != null) {
            var a = doc.createElement("a");
            a.href = link;
            a.appendChild(textTitle);
            divTitle.appendChild(a);
        } else {
            divTitle.appendChild(textTitle);
        }
        theme.event.bubble.titleStyler(divTitle);
        elmt.appendChild(divTitle);

        var divBody = doc.createElement("div");
        this.fillDescription(divBody);
        theme.event.bubble.bodyStyler(divBody);
        elmt.appendChild(divBody);
     };
    </script>


Then, when i call timeline, i use this code:
<script type="text/javascript">
    var tl;
    function onLoad() {
        var eventSource = new Timeline.DefaultEventSource();
        var theme = Timeline.ClassicTheme.create();
            theme.ether.backgroundColors[0] = '#DFD';
            theme.ether.backgroundColors[1] = '#EDD';
            theme.ether.highlightColor = '#E00';
            theme.ether.highlightOpacity = '30';
            theme.event.bubble.width = 400;
            theme.event.bubble.height = 150;
            theme.event.label.width = 250;
        var bandInfos = [
        Timeline.createBandInfo({
            eventSource: eventSource,
            date: "<?php echo $middleXML;?>",
            width: "100%",
            intervalUnit: Timeline.DateTime.<?php echo $grain;?>,
            intervalPixels: 100,
            theme: theme,
            trackHeight: 1.1,    // par défaut à 1.5em
        })
        ];
        tl = Timeline.create(document.getElementById("my-timeline"),
bandInfos);
        Timeline.loadXML("pipo.xml", function(xml, url)
{ eventSource.loadXML(xml, url); });
    }
    var resizeTimerID = null;
    function onResize() {
        if (resizeTimerID == null) {
            resizeTimerID = window.setTimeout(function() {
                resizeTimerID = null;
                tl.layout();
            }, 500);
        }
    }
    </script>




Aditionnaly, this is my php code where i construct the XML fime called
from Timeline:

<?php
$doc = new DOMDocument();
$root = $doc->createElement('data');
$doc->appendChild($root);
$nb_docs = 0;
for ($i=($debut_affichage-1); $i<=($fin_affichage-1); $i++) {
    for ($j=0 ; $j<=$compte[$i] ; $j++) {
        $document = 'baseXML/'.$titre_[$i][$j].'.doc';
        if (file_exists($document)) {
            $xml = simplexml_load_file($document);
            $namespaces = $xml->getNamespaces();
            foreach ($namespaces as $prefix => $ns) {
                $xml->registerXPathNamespace($prefix, $ns);
            }
            $result = $xml->xpath('//'.$prefix.':b...@id='.$paragraphe[$i]
[$j].']');
            foreach ($result as $t) {
            $paragraphe_seul[$nb_docs] = '<em>'.utf8_encode($titre[$i][$j]).'
'.utf8_decode('§').$paragraphe[$i][$j].'</em><br/><br/>'.utf8_decode
($t).'<br/><br/>';
            if ($j == 0)
                $texte[$i] = $texte[$i].$paragraphe_seul[$nb_docs];
            else
                $texte[$i] = $texte[$i].'<hr/>'.$paragraphe_seul[$nb_docs];
            }
        }
        else
            echo 'erreur pendant le chargement du document <b>'.$titre[$i]
[$j].'</b><br/>';
        $nb_docs++;
    }
    $event[$i] = $doc->createElement('event');
    $root->appendChild($event[$i]);
    $text[$i] = $doc->createTextNode(utf8_encode($texte[$i]));
    $event[$i]->appendChild($text[$i]);

    $start_event[$i] = $doc->createAttribute('start');
    $event[$i]->appendChild($start_event[$i]);
    $start_value = $doc->createTextNode(utf8_encode($start[$i]));
    $start_event[$i]->appendChild($start_value);

    $end_event[$i] = $doc->createAttribute('end');
    $event[$i]->appendChild($end_event[$i]);
    $end_value[$i] = $doc->createTextNode(utf8_encode($end[$i]));
    $end_event[$i]->appendChild($end_value[$i]);

    $title_event[$i] = $doc->createAttribute('title');
    $event[$i]->appendChild($title_event[$i]);
    $tmp = $compte[$i] +1;
    if ($compte[$i] > 0)
        $title_value[$i] = $doc->createTextNode(utf8_encode($citation
[$i]).' ('.$tmp.' items)');
    else
        $title_value[$i] = $doc->createTextNode(utf8_encode($citation[$i]));
    $title_event[$i]->appendChild($title_value[$i]);
}
$doc->save('pipo.xml');
?>

Am I doing something wrong?
Thx for your help and thaks for having developed this amazing tool!


      
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to