Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 925419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:31:03+00:00 2026-05-15T19:31:03+00:00

I would like to create an organisational chart as shown here: http://code.google.com/apis/visualization/documentation/gallery/orgchart.html I can

  • 0

I would like to create an organisational chart as shown here:
http://code.google.com/apis/visualization/documentation/gallery/orgchart.html

I can create the JSON google.visualization.DataTable string using the .NET Visualization helper library from here:
http://code.google.com/p/bortosky-google-visualization/

Unfortunately with this helper library it is not possible to display a custom format message like President or Vice President for each organisational chart member as the f: key is not generated by the helper library.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:31:03+00:00Added an answer on May 15, 2026 at 7:31 pm

    I was able to solve this question by writing a method that creates the organisational chart JSON from a C# DataTable:

    public string GoogleOrgChartJson(DataTable dt)
            {
                if ((dt == null) || (dt.Columns.Count == 0)) return "";
                var sb = new StringBuilder();
                sb.Append("{cols: [");
                foreach (DataColumn dc in dt.Columns.Cast<DataColumn>().Where(dc => dc.Caption != "Format"))
                {
                    sb.Append("{id: '");
                    sb.Append(dc.Caption);
                    sb.Append("', label: '");
                    sb.Append(dc.Caption);
                    sb.Append("', type: '");
                    sb.Append(dc.DataType.Name.ToLower());
                    sb.Append("'}, ");
                }
                sb.Remove(sb.Length - 2, 2);
                sb.Append("], rows: [");
                foreach (DataRow dr in dt.Rows)
                {
                    sb.Append("{c: [");
                    for (int i = 0; i < dt.Columns.Count; i++)
                    {
                        if (dt.Columns[i].ToString() == "Format")
                        {
                            sb.Remove(sb.Length - 3, 3);
                            sb.Append(", f: '");
                        }
                        else
                            sb.Append("{v: '");
    
                        if ((dr[i] != DBNull.Value) && (string)dr[i] != "")
                            sb.Append(dr[i] + "'}, ");
                        else
                            sb.Append("'}, ");
    
                    }
                    sb.Remove(sb.Length - 2, 2);
                    sb.Append("]}, ");
                }
                sb.Remove(sb.Length - 2, 2);
                sb.Append("]};");
                return sb.ToString();
            }
    

    As you see from the code above we need to have a DataTable with a column called Format in order to generate the f key in the JSON.
    Please find below an example of a C# DataTable and the call to create the JSON for the google chart API:

    var dt = new DataTable();
    dt.Columns.Add("Name", typeof (String)).Caption = "Name";
    dt.Columns.Add("Format", typeof (String)).Caption = "Format";
    dt.Columns.Add("Manager", typeof (String)).Caption = "Manager";
    dt.Rows.Add("Mathias Florin","Mathias Florin<div style=color:red; font-style:italic><p style=font-size:0.7em>Technical Leader</p></div>","Christian Florin");
    dt.Rows.Add("Christian Florin","Christian Florin<div style=color:red; font-style:italic><p style=font-size:0.7em>CEO</p></div>","Christian Florin");
    Page.ClientScript.RegisterStartupScript(GetType(), "vis", string.Format("var fundata = {0}", GoogleOrgChartJson(dt)), true);
    

    Additional columns can be added after the Manager column and can be accessed in JavaScript in the select event of the google chart api.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.