Here are the code files that I got to work with their examples for a graph
but as you know I'd like it changed slightly to output to an orgchart.
Thanks for all of your help.

On Fri, Nov 14, 2014 at 10:32 AM, Edward Sokolove <[email protected]>
wrote:

> I'm really trying to find an example of how to connect a SQL Server DB to
> populate the orgChart.  I've looked and have not found a good working
> example.  I found a really good one for a pie chart but not exactly sure
> how to convert it to an orgchart.  Any help would be greatly appreciated.
>
> On Monday, November 10, 2014 7:47:43 AM UTC-7, Edward Sokolove wrote:
>>
>> I wanted to know how I would integrate a recordset from a sql server
>> database?  I'm creating an org chart.  Also, how do I set options like
>> collapsible =true?
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Google Visualization API" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-visualization-api/7R83Swnufm0/unsubscribe
> .
> To unsubscribe from this group and all its topics, 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.
>

-- 
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.
#region " [ Using ] "   
using System;   
using System.Web.UI;   
using System.Data.SqlClient;   
using System.Data;   
using System.Configuration;   
using System.Text;   
#endregion   
   
   
public partial class Graph : System.Web.UI.Page   
{   
    protected void Page_Load(object sender, EventArgs e)   
    {   
        if (!Page.IsPostBack)   
        {   
            // Bind Gridview   
            BindGvData();   
   
            // Bind Charts   
            BindChart();   
        }   
    }   
   
    private void BindGvData()   
    {   
        gvData.DataSource = GetChartData();   
        gvData.DataBind();   
    }   
   
    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["Average"] + "],");   
            }   
            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();   
        }   
    }   
   
    /// <summary>   
    /// fetch data from mdf file saved in app_data   
    /// </summary>   
    /// <returns>DataTable</returns>   
    private DataTable GetChartData()   
    {   
        DataSet dsData = new DataSet();   
        try   
        {
            SqlConnection sqlCon = new 
SqlConnection(ConfigurationManager.ConnectionStrings["JPPSONCConnectionString1"].ConnectionString);
   
            SqlDataAdapter sqlCmd = new SqlDataAdapter("GetData", sqlCon);   
            sqlCmd.SelectCommand.CommandType = CommandType.StoredProcedure;   
   
            sqlCon.Open();   
   
            sqlCmd.Fill(dsData);   
   
            sqlCon.Close();   
        }   
        catch   
        {   
            throw;   
        }   
        return dsData.Tables[0];   
    }   
}  

Attachment: Graph.aspx
Description: XML document

Reply via email to