Hi, I am aiming to produce a Sankey diagram. I have the following code
(below in blue) which works ok here:
https://jsfiddle.net/api/post/library/pure/. However, I was wondering if it
was also possible to control the ordering of the output so the left side is
always ordered D, X, Y, Z, A, O and the right side is always ordered C, M,
B, S, going downwards? The ordering seems to rearrange on the chart when it
is produced.
Further I was wondering if it is possible to know how one builds in coding
which can allow control of colour using HTML colour codes of individual
nodes and links. And to adjust the font size and type.
Any help would be much appreciated. I have a fairly limited coding
knowledge. The edits I've tried adding from the guidelines have led to the
chart not being able to run.
Cheers,
DK
google.charts.load('current', {'packages':['sankey']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'From');
data.addColumn('string', 'To');
data.addColumn('number', 'Weight');
data.addRows([
['D', 'C', 37.1],
['X', 'M', 4.3],
['X', 'B', 21.6],
['X', 'S', 49.4],
['Y', 'M', 0],
['Y', 'B', 4.5],
['Y', 'S', 26.7],
['Z', 'M', 0],
['Z', 'B', 0],
['Z', 'S', 48.9],
['A', 'M', 0],
['A', 'B', 3.8],
['A', 'S', 47.8],
['O', 'M', 0.2],
['O', 'B', 13.6],
['O', 'S', 0]
]);
// Sets chart options.
var colors = ['#a6cee3', '#b2df8a', '#fb9a99', '#fdbf6f',
'#cab2d6', '#ffff99', '#1f78b4', '#33a02c'];
var options = {
height: 300,
width: 450,
sankey: {
node: {
colors: colors
},
link: {
colorMode: 'gradient',
colors: colors
}
}
};
// Instantiates and draws our chart, passing in some options.
var chart = new
google.visualization.Sankey(document.getElementById('sankey_basic'));
chart.draw(data, options);
}
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/8fe2f2ec-a314-4597-820e-f153e80d4898%40googlegroups.com.