1d742a0bd3f7460294afdad740ebbaf25c1d5d9d
[dygraphs.git] / plotkit_v091 / tests / quickstart-svg.html
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 <html
5 xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
6 xmlns:svg="http://www.w3.org/2000/svg"
7 xmlns:xlink="http://www.w3.org/1999/xlink">
8 <head>
9 <object id="AdobeSVG" width="1" height="1" classid="clsid:78156a80-c6a1-4bbf-8e6a-3cd390eeb4e2"></object>
10 <?import namespace="svg" implementation="#AdobeSVG"?>
11 <title>PlotKit: Quickstart SVG Demo</title>
12 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
13 <link href="/css/page.css" media="screen" rel="Stylesheet"
14 type="text/css" />
15 <link href="tests.css" media="screen" rel="Stylesheet" type="text/css" />
16 <script src="/js/mochi/MochiKit.js" type="text/javascript"></script>
17 <script src="/js/plotkit-svn/excanvas.js" type="text/javascript"></script>
18 <script src="/js/plotkit-svn/PlotKit_Packed.js" type="text/javascript"></script>
19 </head>
20
21 <body>
22 <div id="body">
23 <h2>Quickstart SVG Demo</h2>
24
25 <div style="margin: 0 auto 0 auto; width: 500px;">
26 <div id="svgcontainer" style="width: 500px; height:300px;"></div>
27 <br/>
28
29 <table id="values" class="data">
30 <thead>
31 <tr><td>x</td><td>y1</td><td>y2</td></tr>
32 </thead>
33 <tbody>
34 <tr><td>0</td><td>0</td><td>3</td></tr>
35 <tr><td>1</td><td>10</td><td>20</td></tr>
36 <tr><td>2</td><td>5</td><td>10</td></tr>
37 <tr><td>3</td><td>6</td><td>7</td></tr>
38 <tr><td>4</td><td>7</td><td>8</td></tr>
39 <tr><td>5</td><td>6</td><td>7</td></tr>
40 <tr><td>6</td><td>7</td><td>8</td></tr>
41 </tbody>
42 </table>
43
44 <p><em>Note: With SVG, the most compatible way is NOT to put in SVG tags, but create the SVG element with Javascript. Therefore, instead of adding &lt;svg&gt; tag, we just have a &lt;div&gt; container and create the SVG element using SVGRenderer.SVG().</em></p>
45
46 <script type="text/javascript">
47 var layout = new Layout("line");
48 layout.addDatasetFromTable("dataset2", $("values"), xcol = 0, ycol = 2);
49 layout.addDatasetFromTable("dataset1", $("values"), xcol = 0, ycol = 1);
50 layout.evaluate();
51
52 var svg = SVGRenderer.SVG({"width": 500, "height": 300, "id":"chart"});
53 $('svgcontainer').appendChild(svg);
54 var chart = new SweetSVGRenderer(svg, layout);
55 chart.render();
56 </script>
57 </div>
58
59 <div class="footer"><a href="http://www.liquidx.net/plotkit/">PlotKit</a></div>
60 </div>
61 </body></html>