element 'elementName': path data missing a moveto [Archive] - XML Elves

element 'elementName': path data missing a moveto

Anonymous
07-26-2005, 02:34 PM
Hi there,
I am stuck at this point since last two days :cry: :cry: . I have explicitely mentioned moveto character M with point, I still get this error. the peice of code where I get this error: element 'curve': path data missing a moveto

any variable starting with "js_" is a javascript variable.
curve is an svg path defined in another script language called DSP.

the partial related code is shown below. I can draw a graph for the first time, after I move a point, the graph just stays unchanged and I get the above mentioned error. I would really appreciate it if someone can show any error here.

<script language="JavaScript" type="text/javascript">
<![CDATA[
function reDraw()
trace="M"+js_X[0]+" "+js_Y[0]+"L";
for (i=1;i<js_Y.length;i++)
{trace=trace+js_X[i]+"'"+js_Y[i]+" "};
trace="' "+trace+ "' stroke='yellow' fill='none' stroke-width='5' ";
curve.setAttribute("d",trace);
alert(trace);

}


function movePoint(evt)
{
y=evt.getClientY();

js_Y[i]=(js_min + js_size*(450-y)/450);

reDraw();
}
}

]]></script>


<!-- DSP
iGraph = "<path id='curve' d='M" + js_X[0] + "," + js_Y[0];
for(i=1;i<js_Y.size;i++)
iGraph += "L" + js_X[i] + "," + js_Y[i];

iGraph += "' stroke='yellow' fill='none' stroke-width='5'/>";
graph.render();
-->


<!-- DSPOBJECT name = graph
iGraph
-->

Anonymous
07-27-2005, 02:51 AM
function reDraw()
trace="M"+js_X[0]+" "+js_Y[0]+"L";
for (i=1;i<js_Y.length;i++)
{trace=trace+js_X[i]+"'"+js_Y[i]+" "};
trace="' "+trace+ "' stroke='yellow' fill='none' stroke-width='5' ";
curve.setAttribute("d",trace);
alert(trace);


I see some mistakes
"'" as separator between coordinates
you cannot put stroke, fill ... in d attribute

function reDraw()
trace="M"+js_X[0]+","+js_Y[0]+"L";
for (i=1;i<js_Y.length;i++)
{trace=trace+"L" + js_X[i]+","+js_Y[i]+" "};
curve.setAttribute("d",trace);
curve.setAttribute("stroke",'yellow');
curve.setAttribute("fill",'none');
curve.setAttribute("stroke-width",'5');
alert(trace);


Michel

Anonymous
07-27-2005, 07:31 AM
Dear Michale,

Thank you very much for your reply. I have tried your suggestion too, and with your suggestion, I get following error: element 'curve': path data command 'L' bad or missing Parameter(s)

I have range of values in js_Y[] : 6.900000000000000e-001 thru 1.197000000000000e-001
if that matters...

Thanks a lot again
DD

Anonymous
07-27-2005, 10:02 AM
Now since I changed the code as mentioned above, it redraws graph at some wierd points, I get correct point valies for alert(curve,getAttribute("d")) . I still don't know what I'm doing wrong....

I would really appreciate it if someone would help me...

function reDraw() {
trace="M"+js_X[0]+","+js_Y[0]+"L";
for (i=1;i<js_Y.length;i++)
{trace=trace+"L" + js_X[i]+" "+js_Y[i]};
curve.setAttribute("d",trace);
curve.setAttribute("stroke",'yellow');
curve.setAttribute("fill",'none');
curve.setAttribute("stroke-width",'5');
alert(curve.getAttribute("d"));
}

Anonymous
07-28-2005, 05:36 AM
I don't see L command before for(...)
Try this


function reDraw() {
trace="M"+js_X[0]+","+js_Y[0];
for (i=1;i<js_Y.length;i++)
{trace=trace+"L" + js_X[i]+" "+js_Y[i]};
curve.setAttribute("d",trace);
curve.setAttribute("stroke",'yellow');
curve.setAttribute("fill",'none');
curve.setAttribute("stroke-width",'5');
alert(curve.getAttribute("d"));
}

Michel

Anonymous
08-03-2005, 10:06 AM
Thank u Michel,

I got a correct graph, I also needed to transform the array values to match the sacle, that was what missing!

Thanks a Lot!

 
Web mp2kmag.com
mapforums.com

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum