File: gviz.html

package info (click to toggle)
dygraphs 2.2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,340 kB
  • sloc: javascript: 24,842; sh: 800; python: 581; makefile: 45
file content (66 lines) | stat: -rw-r--r-- 2,223 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>gviz</title>

    <link rel="stylesheet" type="text/css" href="../dist/dygraph.css" />
    <link rel="stylesheet" type="text/css" href="../common/vextlnk.css" />
    <script type="text/javascript" src="../dist/dygraph.js"></script>

    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript"><!--//--><![CDATA[//><!--
    Dygraph.onDOMready(function onDOMready() {
      google.load('visualization', '1', {packages: ['linechart']});

      function createDataTable(dateType) {
        data = new google.visualization.DataTable();
        data.addColumn(dateType, 'Date');
        data.addColumn('number', 'Column A');
        data.addColumn('number', 'Column B');
        data.addRows(4);
        data.setCell(0, 0, new Date("2009/07/01"));
        data.setCell(0, 1, 1);
        data.setCell(0, 2, 7);
        data.setCell(1, 0, new Date("2009/07/08"));
        data.setCell(1, 1, 2);
        data.setCell(1, 2, 4);
        data.setCell(2, 0, new Date("2009/07/15"));
        data.setCell(2, 1, 3);
        data.setCell(2, 2, 3);
        data.setCell(3, 0, new Date("2009/07/22"));
        data.setCell(3, 1, 4);
        data.setCell(3, 2, 0);
        return data;
      }

      function drawVisualization() {
        data = createDataTable('date');
        new google.visualization.LineChart(
            document.getElementById('gviz')).draw(data, null);

        var chart1 = new Dygraph.GVizChart(
            document.getElementById('dygraphs')).draw(data, {
            });

        data = createDataTable('datetime');
        var chart2 = new Dygraph.GVizChart(
            document.getElementById('dygraphs_datetime')).draw(data, {
            });

      }
      google.setOnLoadCallback(drawVisualization);
    });
    //--><!]]></script>
  </head>
  <body>
    <p>gviz line chart:</p>
    <div id="gviz" style="width:600px; height:300px;"></div>

    <p>same data drawn using dygraphs:</p>
    date column:
    <div id="dygraphs" style="width:600px; height:300px;"></div>
    datetime column:
    <div id="dygraphs_datetime" style="width:600px; height:300px;"></div>
  </body>
</html>