forked from mbostock's block: selection.order
forked from anonymous's block: selection.order().exit().remove()
forked from etpinard's block: trace struct flattener
xxxxxxxxxx
<html>
<body>
<div id='graph'></div>
<script type="text/javascript" src="https:/cdn.plot.ly/plotly-latest.min.js"></script>
<script type="text/javascript">
var d3 = Plotly.d3;
function plot(data) {
var s = d3.select('#graph').selectAll('p')
.data(data);
s.enter().append('p');
s.text(function(d) { return d.type + ' ' + d.uid;} );
//s.order().exit();
}
var data0 = [{
type: 'scatter',
uid: '0'
}, {
type: 'bar',
uid: '1'
}, {
type: 'heatmap',
uid: '2'
}, {
type: 'contour',
uid: '2.5'
}];
plot(data0)
var data1 = [{
type: 'scatter',
uid: '1'
}, {
type: 'bar',
uid: '0'
}, {
type: 'heatmap',
uid: '2'
}, {
type: 'histogram',
uid: '3'
}];
plot(data1);
</script>
</body>
</html>
https:/cdn.plot.ly/plotly-latest.min.js