Because of external constraints, I want to be able to display a time-
series graphic as an inline HTML block. Timeplot looks perfect for
that.

I have first dynamically loading the javascript "timeplot-api.js", and
then I want to be able to load "inline" data. I have tried to copy the
idea introduced at
http://www.ericmmartin.com/traffic-charts-for-my-commute/

But for some reason I can't get the code below to work. Does anyone
knows what's wrong with this piece of code?

Thanks in advance,
Joannes Vermorel


<html>
<head>
        <script src="http://static.simile.mit.edu/timeplot/api/1.0/timeplot-
api.js"
       type="text/javascript"></script>
</head>
<body>
Sample graphic

        <div id="my-timeplot" style="height: 150px;"></div>

        <script type="text/javascript">
        <!--

        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = 'http://static.simile.mit.edu/timeplot/api/1.0/timeplot-
api.js';
        document.getElementsByTagName('head')[0].appendChild(script);

        Timeplot._Impl.prototype.loadInline=function(eventSource)
        {
                if(this._active)
                {
                        eventSource.loadInline();
                }
        }

        Timeplot.DefaultEventSource.prototype.loadInline=function()
        {
                alert("Hello World1!");
                this._events.maxValues=new Array();

                var evt1=new Timeplot.DefaultEventSource.NumericEvent(new Date
(2009,1,1), 10);
                var evt2=new Timeplot.DefaultEventSource.NumericEvent(new Date
(2009,1,2), 15);

                this._events.add(evt1);
                this._events.add(evt2);

                this._fire('onAddMany',[]);
        }

        var eventSource = new Timeplot.DefaultEventSource();

        var plotInfo = [
                Timeplot.createPlotInfo({
                        id: "plot1",
                        dataSource: new Timeplot.ColumnSource(eventSource,1)
                })
        ];
        timeplot = Timeplot.create(document.getElementById("my-timeplot"),
plotInfo);

        timeplot.loadInline(eventSource);

  -->
        </script>
</body>
</html>
--~--~---------~--~----~------------~-------~--~----~
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