mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
Merge pull request #1222 from getredash/feature/sunburst_visualization
Add: additional results format for sunburst visualization
This commit is contained in:
commit
a02eddabb5
@ -417,6 +417,7 @@
|
||||
var nodeName = nodes[j];
|
||||
var isLeaf = j + 1 === nodes.length;
|
||||
|
||||
|
||||
if (!children) {
|
||||
currentNode.children = children = [];
|
||||
children.push({
|
||||
@ -455,16 +456,31 @@
|
||||
}
|
||||
|
||||
function buildNodes(raw) {
|
||||
var grouped = _.groupBy(raw, 'sequence');
|
||||
var values;
|
||||
|
||||
var values = _.map(grouped, function(value, key) {
|
||||
var sorted = _.sortBy(value, 'stage');
|
||||
return {
|
||||
size: value[0].value,
|
||||
sequence: value[0].sequence,
|
||||
nodes: _.pluck(sorted, 'node')
|
||||
}
|
||||
});
|
||||
if (_.has(raw[0], 'sequence') && _.has(raw[0], 'stage') && _.has(raw[0], 'node') && _.has(raw[0], 'value')) {
|
||||
|
||||
var grouped = _.groupBy(raw, 'sequence');
|
||||
|
||||
var values = _.map(grouped, function(value, key) {
|
||||
var sorted = _.sortBy(value, 'stage');
|
||||
return {
|
||||
size: value[0].value,
|
||||
sequence: value[0].sequence,
|
||||
nodes: _.pluck(sorted, 'node')
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var keys = _.sortBy(_.without(_.keys(raw[0]), 'value'), _.identity);
|
||||
|
||||
values = _.map(raw, function(row, sequence) {
|
||||
return {
|
||||
size: row.value,
|
||||
sequence: sequence,
|
||||
nodes: _.compact(_.map(keys, function(key) { return row[key] }))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
@ -7,13 +7,24 @@
|
||||
</div>
|
||||
<div>
|
||||
<hr>
|
||||
This visualization expects the query result to have rows with the following columns:
|
||||
This visualization expects the query result to have rows in one of the following formats:
|
||||
|
||||
<strong>Option 1:</strong>
|
||||
<ul>
|
||||
<li><strong>sequence</strong> - sequence id</li>
|
||||
<li><strong>stage</strong> - what stage in sequence this is (1, 2, ...)</li>
|
||||
<li><strong>node</strong> - stage name</li>
|
||||
<li><strong>value</strong> - number of times this sequence occurred</li>
|
||||
</ul>
|
||||
|
||||
<strong>Option 2:</strong>
|
||||
<ul>
|
||||
<li><strong>stage1</strong> - stage 1 value</li>
|
||||
<li><strong>stage1</strong> - stage 2 value (or null)</li>
|
||||
<li><strong>stage3</strong> - stage 3 value (or null)</li>
|
||||
<li><strong>stage4</strong> - stage 4 value (or null)</li>
|
||||
<li><strong>stage5</strong> - stage 5 value (or null)</li>
|
||||
<li><strong>value</strong> - number of times this sequence occurred</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user