Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18645

How do I best write a new polyline with the original one removed

From "Tony" <tony.johansson@inport.com>
Newsgroups comp.lang.javascript
Subject How do I best write a new polyline with the original one removed
Date 2013-02-27 09:47 +0100
Organization A noiseless patient Spider
Message-ID <kgkh55$1qe$1@dont-email.me> (permalink)

Show all headers | View raw


I list below how the body tag look like.
When I want to draw a polyline I call function CreatePolyLine as you can see 
below.
I have earlier loaded the prognosisArray with the points(x,y) that I will 
use.

My problem is what is the best way to draw a new polyline with the original 
one removed ?

var svgNS = "http://www.w3.org/2000/svg";

function CreatePolyLine()
    {
        var myPolyLine = document.createElementNS(svgNS, "polyline");

        var points = "";
        for (i = 0; i < prognosisArray.length; i++)
        {
            if (prognosisArray[i].x != 0 && prognosisArray[i].y != 0)
            {
                points += prognosisArray[i].x + "," + prognosisArray[i].y + 
" ";
            }
        }

        myPolyLine.setAttribute("points", points);
        myPolyLine.setAttribute("stroke", "blue");
        myPolyLine.setAttribute("stroke-width", "1");
        myPolyLine.setAttribute("fill", "none");
        document.getElementById("mySVG").appendChild(myPolyLine);
    }

<body>
   <div id="logo">
       <span class="headerDateTimeRight" id="mydateTime"></span>
       <img alt="" src="../Images/gotris.jpg" id="logoSize"  />
      <p>For better and smother shipping on götaälv</p>
   </div>

   <br />
   <ul id="nav">
        <li><a class="menuItem"  href="Lots.html">Pilot</a></li>
        <li><a class="menuItem" href="Viva.html">Weather</a></li>
        <li><a class="menuItem" href="Moten.html">Meetings</a></li>
        <li><a class="menuItem" href="Schema.html">Schedule</a></li>
        <li><a class="menuItem" onclick="return confirm('Do you really want 
to enter new vessel data')" href="SelectShip.html">SelectShipData</a></li>
        <li class="right"><a class="logout" onclick="return LogOut()" 
href="Login.html">Log out</a></li>
   </ul>
   <br /><br />

    <div id="meetings">
       <svg id="mySVG" xmlns="http://www.w3.org/2000/svg" 
xmlns:xlink="http://www.w3.org/19 99/xlink" version="1.1">
       </svg>
    </div>
</body>

//Tony 

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

How do I best write a new polyline with the original one removed "Tony" <tony.johansson@inport.com> - 2013-02-27 09:47 +0100
  Re: How do I best write a new polyline with the original one removed "Tony" <tony.johansson@inport.com> - 2013-02-27 11:12 +0100

csiph-web