Note that there are some explanatory texts on larger screens.

plurals
  1. PORelation between the drawn node and the data node in Google chart/visualization
    primarykey
    data
    text
    <p>I'm using a Google Org Chart to show a site's page hierarchy.</p> <p>I would like to colour the boxes based on some other factor - specifically the last update time of the page, but this question is more general.</p> <p>I can load the data and draw the chart. </p> <p>I've added an extra column to the data and drawn the chart.</p> <p>Then <code>document.querySelectorAll('.google-visualization-orgchart-node');</code> gives me a list of the charts nodes.</p> <p>But I can't work out how to join this back to the data. I could parse the text content, but this seems really messy/hacky.</p> <p><strong>Is there no relation between the drawn node and the data node?</strong></p> <p>I edited a Google sample to include an extra data column, and its on jsfiddle here <a href="http://jsfiddle.net/adrianjmartin/4Xadv/" rel="nofollow">http://jsfiddle.net/adrianjmartin/4Xadv/</a></p> <pre><code> &lt;!-- You are free to copy and use this sample in accordance with the terms of the Apache license (http://www.apache.org/licenses/LICENSE-2.0.html) --&gt; &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt; &lt;title&gt; Google Visualization API Sample &lt;/title&gt; &lt;script type="text/javascript" src="//www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; google.load('visualization', '1', { packages: ['orgchart'] }); &lt;/script&gt; &lt;script type="text/javascript"&gt; function drawVisualization() { // Create and populate the data table. var data = new google.visualization.DataTable; data.addColumn('string', 'Name'); data.addColumn('string', 'Manager'); data.addColumn('string', 'ToolTip'); data.addColumn('string' , 'extraData') var r; r = data.addRow(['Mike', null, 'The President','a']); data.addRow([{ v: 'Jim', f: 'Jim&lt;br/&gt;&lt;font color="red"&gt;&lt;i&gt;Vice President&lt;i&gt;&lt;/font&gt;' }, 'Mike', null,'b']); data.addRow(['Alice', 'Mike', null,'c']); data.addRow(['Bob', 'Jim', 'Bob Sponge','d']); data.addRow(['Carol', 'Bob', null,'e']); // Create and draw the visualization. var v = document.getElementById('visualization'); var orgChart = new google.visualization.OrgChart(v); orgChart.draw(data, { allowHtml: true }); var nodes = document.querySelectorAll('.google-visualization-orgchart-node'); for (var i = 0 ; i &lt; nodes.length; i++) { console.log(nodes[i]); } } google.setOnLoadCallback(drawVisualization); &lt;/script&gt; &lt;/head&gt; &lt;body style="font-family: Arial;border: 0 none;"&gt; &lt;div id="visualization" style="width: 300px; height: 300px;"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload