tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

extend-namespace-01-f-novalid.html (7393B)


      1 <!DOCTYPE html>
      2 <html lang='en'>
      3 <head>
      4 <title>extend-namespace-01-f-manual.svg</title>
      5 <meta charset='utf-8'>
      6 </head>
      7 <body>
      8 <h1>Source SVG: extend-namespace-01-f-manual.svg</h1>
      9 <svg version="1.1" baseProfile="full" onload="onLoad(evt)" id="svg-root"
     10  width="100%" height="100%" viewBox="0 0 480 360"
     11  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
     12  <!--======================================================================-->
     13  <!--=  SVG 1.1 2nd Edition Test Case                                     =-->
     14  <!--======================================================================-->
     15  <!--=  Copyright 2009 World Wide Web Consortium, (Massachusetts          =-->
     16  <!--=  Institute of Technology, European Research Consortium for         =-->
     17  <!--=  Informatics and Mathematics (ERCIM), Keio University).            =-->
     18  <!--=  All Rights Reserved.                                              =-->
     19  <!--=  See http://www.w3.org/Consortium/Legal/.                          =-->
     20  <!--======================================================================-->
     21  
     22  <title id="test-title">$RCSfile: extend-namespace-01-f.svg,v $</title>
     23  <defs>
     24    <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F">
     25      <font-face-src>
     26        <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
     27      </font-face-src>
     28    </font-face>
     29  </defs>
     30  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
     31    <g xmlns:bd="http://example.org/ExampleBusinessData" xmlns="http://www.w3.org/2000/svg">
     32      <defs>
     33        <script type="text/ecmascript">
     34          var svg_ns = "http://www.w3.org/2000/svg";
     35          var bd_ns = "http://example.org/ExampleBusinessData";
     36          function onLoad(evt){
     37          // Get Document
     38          var svgElement = evt.target;
     39          var doc = svgElement.ownerDocument;
     40 
     41          var resultsElement = doc.getElementById('results');
     42          var gElement = doc.getElementById('PieParent');
     43 
     44          // Count the number of regions.
     45          RegionNodeList = doc.getElementsByTagNameNS(bd_ns, "Region");
     46          regionCount = RegionNodeList.length;
     47 
     48          // Get the region data.
     49          RegionNameNodeList = doc.getElementsByTagNameNS(bd_ns, "RegionName");
     50          RegionResultNodeList = doc.getElementsByTagNameNS(bd_ns, "RegionResult");
     51 
     52          // Get the sum of the values of the regions.
     53          var total = 0;
     54          for (regionIndex = 0; regionIndex &lt; regionCount; regionIndex++)
     55          total = total + Number(RegionResultNodeList.item(regionIndex).firstChild.nodeValue);
     56 
     57          // Build a pie chart.
     58          var startAngle = 0;
     59          for (regionIndex = 0; regionIndex &lt; regionCount; regionIndex++) {
     60          regionName = RegionNameNodeList.item(regionIndex).firstChild.nodeValue;
     61          regionResult = Number(RegionResultNodeList.item(regionIndex).firstChild.nodeValue);
     62 
     63          // Build the pie slice.
     64          textElement = doc.createElementNS(svg_ns, "text");
     65          textNode = doc.createTextNode(regionName);
     66          textElement.appendChild(textNode);
     67          pathElement = doc.createElementNS(svg_ns, "path");
     68 
     69          endAngle = startAngle - regionResult * Math.PI * 2 / total;
     70          dAttribute = "M240,170 L";
     71          gray =  Math.round(Number(255 * (regionIndex+2)) / (regionCount+2));
     72          midAngle = (startAngle + endAngle) / 2;
     73          textElement.setAttributeNS(null, "x", Math.round(240+65*Math.cos(midAngle)));
     74          textElement.setAttributeNS(null, "y", Math.round(170+65*Math.sin(midAngle)));
     75 
     76          dAttribute = dAttribute + Math.round(240+100*Math.cos(startAngle));
     77          dAttribute = dAttribute + ',';
     78          dAttribute = dAttribute + Math.round(170+100*Math.sin(startAngle));
     79          dAttribute = dAttribute + ' A100,100 0 0,0 ';
     80          dAttribute = dAttribute + Math.round(240+100*Math.cos(endAngle));
     81          dAttribute = dAttribute + ',';
     82          dAttribute = dAttribute + Math.round(170+100*Math.sin(endAngle));
     83          dAttribute = dAttribute + 'z';
     84          pathElement.setAttributeNS(null, "d", dAttribute);
     85          pathElement.setAttributeNS(null, "fill", "rgb("+gray+","+gray+","+gray+")");
     86          pathElement.setAttributeNS(null, "stroke", "black");
     87          pathElement.setAttributeNS(null, "stroke-width", "2");
     88 
     89          // Temporary, for CSS styling.
     90          pathElement.setAttributeNS(null, "fill", "rgb("+gray+","+gray+","+gray+")");
     91          pathElement.setAttributeNS(null, "stroke", "black");
     92          pathElement.setAttributeNS(null, "stroke-width", "2");
     93 
     94          if (regionIndex == 0) {
     95          var firstSliceOffset = 30;
     96          var transformValue = "translate(" +
     97          Math.round(firstSliceOffset * Math.cos(midAngle)) +
     98          "," +
     99          Math.round(firstSliceOffset * Math.sin(midAngle)) +
    100          ")";
    101          pathElement.setAttributeNS(null, "transform", transformValue);
    102          textElement.setAttributeNS(null, "transform", transformValue);
    103          pathElement.setAttributeNS(null, "fill", "#FF6666");
    104          pathElement.setAttributeNS(null, "stroke", "#0000FF");
    105          pathElement.setAttributeNS(null, "stroke-width", "3");
    106 
    107          // Temporary, for CSS styling.
    108          pathElement.setAttributeNS(null, "fill", "#FF8888");
    109          pathElement.setAttributeNS(null, "stroke", "#0000FF");
    110          pathElement.setAttributeNS(null, "stroke-width", "3");
    111 
    112          }
    113          gElement.appendChild(pathElement);
    114          gElement.appendChild(textElement);
    115          startAngle = endAngle;
    116          }
    117          }
    118        </script>
    119      </defs>
    120      <bd:Results id="results">
    121        <bd:Region>
    122          <bd:RegionName>East</bd:RegionName>
    123          <bd:RegionResult>3</bd:RegionResult>
    124        </bd:Region>
    125        <bd:Region>
    126          <bd:RegionName>North</bd:RegionName>
    127          <bd:RegionResult>4</bd:RegionResult>
    128        </bd:Region>
    129        <bd:Region>
    130          <bd:RegionName>West</bd:RegionName>
    131          <bd:RegionResult>5</bd:RegionResult>
    132        </bd:Region>
    133        <bd:Region>
    134          <bd:RegionName>Central</bd:RegionName>
    135          <bd:RegionResult>3.2</bd:RegionResult>
    136        </bd:Region>
    137        <bd:Region>
    138          <bd:RegionName>South</bd:RegionName>
    139          <bd:RegionResult>6</bd:RegionResult>
    140        </bd:Region>
    141      </bd:Results>
    142      <text font-family="Arial" font-size="16" text-anchor="middle" x="240" y="30">
    143        Pie chart built from data in a different namespace.
    144      </text>
    145    </g>
    146    <g id="PieParent" font-family="Arial" text-anchor="middle" font-size="14">
    147      <desc>Pie chart is built within this 'g' element</desc>
    148    </g>
    149  </g>
    150  <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
    151    <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.8 $</text>
    152  </g>
    153  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
    154  <!-- comment out this watermark once the test is approved -->
    155  <!--<g id="draft-watermark">
    156    <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
    157    <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
    158      text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
    159  </g>-->
    160 </svg>
    161 </body>
    162 </html>