locked
Google organisation chart RRS feed

  • Question

  • Hi,

    I am using google organisation chart.It working fine .It fetches data from sql database .

     var hdValue = document.getElementById("<%=hdData.ClientID%>").value;
                var response = $.parseJSON(hdValue);
                var data = new google.visualization.DataTable();
                data.addColumn('string', 'Employee');
                data.addColumn('string', 'Manager');
                data.addColumn('string', 'PhoneNo');
              
             
                for (var i = 0; i < response.length; i++) {
                    var row = new Array();
                    row[0] = response[i].Employee + '<div class="plus"><img src="images/plus.png" style="height: 27px; width: 33px" /></div>';
                    row[1] = response[i].Manager + '<div class="plus"><img src="images/plus.png" style="height: 27px; width: 33px" /></div>';
                    row[2] = response[i].PhoneNo;
                    
                    data.addRow(row);
                }

    I want to add the phone details in box not on tooltip.

    I am finding difficult to add the phone or any other details because below code

                row[0] = response[i].Employee + '<div class="plus"><img src="images/plus.png" style="height: 27px; width: 33px" /></div>';
                    row[1] = response[i].Manager + '<div class="plus"><img src="images/plus.png" style="height: 27px; width: 33px" 

    both the row 0 and row 1 expects same value example if i remove the image from employee then the design wont come properly.

    Here i found the code where i can the details 

       data.addColumn('string', 'Name');
        data.addColumn('string', 'Manager');
        data.addColumn('string', 'ToolTip');
        data.addRows([
            [{v: 'Mike', f: 'Mike<div style="color:#196589; font-style:italic">President</div><div class="plus"><img src="http://1.bp.blogspot.com/-IsfgLDHMUG8/UFxkw3uSMdI/AAAAAAAAApE/3TLxFtPQTBE/s1600/pus.png"></div>'}, '', 'The President'],Its additional text(i can add phone number like this)
            [{v: 'Jim', f: 'Jim<div style="color:#196589; font-style:italic">Vice President</div><div class="plus"><img src="http://1.bp.blogspot.com/-IsfgLDHMUG8/UFxkw3uSMdI/AAAAAAAAApE/3TLxFtPQTBE/s1600/plus.png"></div>'}, 'Mike', 'VP'],
            ['Alice', 'Mike', ''],
            [{v: 'Bob', f: 'Bob<div class="plus"><img src="http://1.bp.blogspot.com/-IsfgLDHMUG8/UFxkw3uSMdI/AAAAAAAAApE/3TLxFtPQTBE/s1600/plus.png"></div>'}, 'Jim', 'Bob Sponge Test'],
            ['Carol', 'Bob', '']
        ]);

    But since i am fetching data from database don t know how to add dynamically.

    Also is it google chart takes only three columns .Please suggest




    • Edited by Shankarbs Wednesday, May 13, 2015 10:39 PM
    • Moved by Kristin Xie Thursday, May 14, 2015 9:45 AM
    Wednesday, May 13, 2015 8:27 PM

Answers

  • Hi Shankarbs,

    This is not a C# code case, please post your question to Google Visualization API forum for a better support on this.

    Thank you.


    Fouad Roumieh

    • Proposed as answer by Kristin Xie Thursday, May 14, 2015 9:45 AM
    • Marked as answer by Just Karl Thursday, May 21, 2015 10:35 PM
    Thursday, May 14, 2015 7:53 AM