I did it.
that's my code....well Thank you!!!! all of you.
the file named data1 must be in same folder with the html file


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<!-- <%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%> -->
  <head>
    <script type="text/javascript" 
src="https://www.google.com/jsapi";></script>
    <script language='javascript' 
src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
    <script type="text/javascript">
    
    google.load('visualization', '1', {packages:['corechart']});
    google.setOnLoadCallback(drawChart);
    
    function drawChart () {
        $.ajax({
            url: 'data1',
            type: 'get',
            success: 
            function(txt){
          var dataArray = [['x', 'y']
                             ];

            for (var i=0;txt!=null; i++){
            var txtArray = txt.split("\n");
var tmpData = txtArray[i].split(" ");

  dataArray.push([tmpData[0], parseInt(tmpData[1])]); 
              var data = google.visualization.arrayToDataTable(dataArray);
            var chart = new 
google.visualization.LineChart(document.getElementById('chart_div'));
    chart.draw(data, {
                    title: 'Company Performance',
                  vAxis: {title: 'Year',  titleTextStyle: {color: 'red'}}});
            } 
        }
        });
    }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to