SharePoint Script Editor

Muhamad Fahrurrozi 41 Reputation points

Dear All,

I have tried to use this with Modern Script Editor.

And it's worked as expected. But, I'm wondering to use SharePoint List as a data source like this one, I have tried but the chart not displayed.


A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,211 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,789 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,141 Reputation points

    Hi @Muhamad Fahrurrozi ,

    According to my research and testing, I can successfully use the code in the article you provided to create an organization chart for SharePoint list items. Here is my test code, please use the code in the attachment and check if it works: 264069-test-1-1.txt

    Note: Select Enable classic _spPageContextInfo

    My test result:




    Hope it can help you. Thanks for your understanding.

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Muhamad Fahrurrozi 41 Reputation points

    Hi @Tong Zhang_MSFT ,

    Thank you for your response.

    Is it possible to put a hyperlink? So, when I click "Joe Derek" or "Michael Jordan" it will redirect to specific Link. Structure column SharePoint List like below image. I have tried using this below html and it works, but it would be perfect if possible to put Link in SharePoint List directly, not a code.

        <script type="text/javascript" src=""></script>  
        <script type="text/javascript">  
          google.charts.load('current', {packages:["orgchart"]});  
          function drawChart() {  
            var data = new google.visualization.DataTable();  
            data.addColumn('string', 'Name');  
            data.addColumn('string', 'Manager');  
            data.addColumn('string', 'ToolTip');  
            // For each orgchart box, provide the name, manager, and tooltip to show.  
              [{'v':'<p style="color:green;">Head</p>'}, '', ''],  
    		   [{'v':'<p style="color:green;">Sub-Head</p>'},  
               '<p style="color:green;">Head</p>', ''],  
    		   [{'v':'<a href="" style="color:orange;" target="_blank">SharePoint Team</a>'},  
               '<p style="color:green;">Sub-Head</p>', '']  
            // Create the chart.  
            var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));  
            // Draw the chart, setting the allowHtml option to true for the tooltips.  
            chart.draw(data, {'allowHtml':true});  
        <div id="chart_div"></div>