using System;
using System.Web.UI;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Text;

using System.Web.UI.WebControls;

namespace SUNWEB
{
    public partial class Testchart : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                BindChart();
            }

        }





        private void BindChart()
        {
            DataTable dsChartData = new DataTable();
            StringBuilder strScript = new StringBuilder();

            try
            {
                //dsChartData = GetChartData();

                strScript.Append(@"<script type='text/javascript'>  
                    google.load('visualization', '1', {packages: ['corechart']});</script>  
  
                    <script type='text/javascript'>  
                    function drawVisualization() {         
                    var data = google.visualization.arrayToDataTable([  
                    ['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Average'],");

                //foreach (DataRow row in dsChartData.Rows)
                //{
                //    strScript.Append("['" + row["Month"] + "'," + row["Bolivia"] + "," +
                //        row["Ecuador"] + "," + row["Madagascar"] + "," + row["Avarage"] + "],");
                //}


                strScript.Append("['" + "Jan" + "'," + 50 + "," +
                        60 + "," + 80 + "," + 30 + "],");

                //strScript.Append("['" + "Feb" + "'," + 60 + "," +
                //        50 + "," + 20 + "," + 30 + "],");

                strScript.Remove(strScript.Length - 1, 1);
                strScript.Append("]);");

                strScript.Append("var options = { title : 'Monthly Coffee Production by Country', vAxis: {title: 'Cups'},  hAxis: {title: 'Month'}, seriesType: 'bars', series: {3: {type: 'area'}} };");
                strScript.Append(" var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));  chart.draw(data, options); } google.setOnLoadCallback(drawVisualization);");
                strScript.Append(" </script>");

                ltScripts.Text = strScript.ToString();
            }
            catch
            {
            }
            finally
            {
                //dsChartData.Dispose();
                strScript.Clear();
            }
        }





    }
}