woong's

Android Google Chart Option 사용하기 본문

Develop/Android

Android Google Chart Option 사용하기

dlsdnd345 2016. 2. 14. 17:19

 

 

 

Colored By Color Scripter

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
67
68
<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
    
      google.load("visualization""1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([$data]);
 
        
        var options = {
            backgroundColor:'#808F97'//배경색
            title: 'My Health Diary'// 타이틀
            pointSize:5,
            titleTextStyle: { 
                color: 'white' // 타이틀 색
            },
            hAxis:{  // 가로
                textStyle:{
                    fontSize:7,
                    color:'white'
                },
                baselineColor:'white' // 수직 왼쪽 선
            },
            vAxis:{ // 세로 
                textStyle:{
                    fontSize:7,
                    color:'white'
                },
                gridlines: { // 중간의 선
                    color: '#8898A1'
                },
                baselineColor:'8898A1' // 하단 선
                
            },
            legend:{ // 항목
                textStyle:{
                    fontSize:7,
                    color:'white'
                }
            },
            series: { // 선색
                0: {
                    color: '#F0A57C'
                },
                1: {
                    color: '#91FFC3'
                }
            }
        };
        
 
        var domElem = document.getElementById ( "chart_div" );
        domElem.style.width = $width + "px";
        domElem.style.height = $height + "px";
        
        var chart = new google.visualization.LineChart(domElem);
        chart.draw(data, options);
      }
    </script>
  </head>
  <body bgcolor="#808F97">
    <div id="chart_div"></div>
  </body>
</html>
 
 

Comments