Hello,

thank you for MochiKit! and PlotKit! (don't know if this is the right
forum to ask this question, perhaps i should post it somewhere under
PlotKit - anyway ...). I have a little problem. Perhaps somebody can
tell what i'm doing wrong.
I have a dynamic graph working in Firefox. If i press a button the
graph redraws, so i can manipulate some variables and press to refresh
the graph. Very nice! But, if i try the same trick in Safari only my
axis values are shown but not the 'canvas'. I haven't started a M$ IE
experiment yet in order not to get depressed using javascript from the
outset.

I have used the following method - and a whole lot more besides ...
but to no avail in Safari

I use a formharvester to get variables from a form - formHarvester
I procede to calculate values for the graph - filling a variable estim
which is a list.

I want to graph the list's values (simple x,y graph - i use the
lineonly layout, which is a modification of the 'line' layout which is
filled - nice but not practical for me).

var rOpts = { "IECanvasHTC": "iecanvas.htc",
                  "colorScheme": PlotKit.Base.palette    \
(PlotKit.Base.baseColors()[2]),
                                  "xOriginIsZero": true,
                                  "xNumberOfTicks": 31,
                                  "drawYAxis": true,
                                  "yAxis": [0.0, 100.0],
                                  "yNumberOfTicks": 10,
                                  "yTickPrecision": 2,
                                  "yOriginIsZero": true };
        var layout = new PlotKit.Layout("lineonly", rOpts);
        layout.addDataset("d1", estim);
        layout.evaluate();
        if ( !MochiKit.DOM.getElement("mgraphic") ){
                rElement = document.createElement("CANVAS");
                rElement.id = "mgraphic";
                rElement.width = 450;
                rElement.height = 250;
        $('container').appendChild(rElement);
        }
    else{
        chart.clear();
            }
    var reserv = MochiKit.DOM.getElement("cmvv");
        chart = new PlotKit.SweetCanvasRenderer(reserv, layout, rOpts);
        chart.render();
        }

In the html page somewhere this node is placed:
<div id="container" style="width: 520px; height:300px; padding-top:
0px;"></div>

This works fine in Firefox. If i try Safari several things seem to go
wrong. First, the html node has to be placed within a <div id="body"></
div> and a <canvas id="mgraphic"></canvas> has to be present before
the canvas shows anything. If i create the node with the 'container'
div, only the axis values are shown.

The 'if .. else' seems to only way to clear the canvas before
redrawing the graph, else the values along the axis mingle - don't get
refreshed. Calling a chart.clear() somewhere in the cicle is useless,
perhaps because the 'graph' gets remade with 'new'
PlotKit.SweetCanvasRenderer. It would be nice to be able to refresh
the canvas and axis in the combination.

Perhaps it would also be nice to be able to give the axis a minimum
and maximum value to be displayed in such a way that always the
minimum and maximum given in the options are shown, with the
layout.dataset within these bounds shown. In that way my rOpts
"yAxis": [0.0, 100.0], would be 'more' usefull, i'm trying to graph %
values, that need to be compaired between graphs - so the y-axis runs
from 0% - 100%.

I'm a total noob in programming - to me the current technology is a
bit like the one radio amateurs used about a 100 years ago - well, i'm
curious if somebody can help me adjust the above crystal set?

Thank you for helping me out.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to