File: api_ygrid_lines.html

package info (click to toggle)
c3 0.4.11%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 2,156 kB
  • sloc: makefile: 18
file content (50 lines) | stat: -rw-r--r-- 1,217 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
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="/css/c3.css">
  </head>
  <body>
    <div id="chart"></div>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
    <script src="/js/c3.js"></script>
    <script>
      var chart = c3.generate({
        bindto: '#chart',
        data: {
          columns: [
            ['sample', 30, 200, 100, 400, 150, 250]
          ]
        },
        axis: {
//          rotated: true,
        },
        grid: {
          y: {
//            lines: [{value: 30, text:'Label 30'}, {value: 250, text: 'Label 250'}]
          }
        }
      });

      setTimeout(function () {
        chart.ygrids([{value: 130, text:'Label 130'}, {value: 50, text: 'Label 50'}]);
      }, 1000);

      setTimeout(function () {
        chart.ygrids([{value: 130, text:'Label 130', class: 'hoge'}]);
      }, 2000);

      setTimeout(function () {
        chart.ygrids.add([{value: 230, text:'Label 230', class: 'hoge'}]);
      }, 3000);

      setTimeout(function () {
        chart.ygrids.remove({value: 230});
      }, 4000);

      setTimeout(function () {
        chart.ygrids.remove({class: 'hoge'});
      }, 5000);

    </script>
  </body>
</html>