Browse Source

Add onend callback for flow

pull/282/head
Masayuki Tanaka 11 years ago
parent
commit
4bfe25de5d
  1. 8
      c3.js
  2. 4
      c3.min.js
  3. 15
      htdocs/samples/api_flow.html

8
c3.js

@ -3944,6 +3944,7 @@
flowEnd = getValueOnIndex(c3.data.targets[0].values, flowIndex + flowLength), flowEnd = getValueOnIndex(c3.data.targets[0].values, flowIndex + flowLength),
orgDomain = x.domain(), orgDomain = x.domain(),
durationForFlow = options.flow.duration || duration, durationForFlow = options.flow.duration || duration,
onend = options.flow.onend || function () {},
wait = generateWait(); wait = generateWait();
// remove head data after rendered // remove head data after rendered
@ -4025,8 +4026,8 @@
.attr("width", __axis_rotated ? width : rectW) .attr("width", __axis_rotated ? width : rectW)
.attr("height", __axis_rotated ? rectW : height); .attr("height", __axis_rotated ? rectW : height);
// callback here? // callback for end of flow
onend();
}); });
} : null); } : null);
@ -4778,7 +4779,8 @@
flow: { flow: {
index: c3.data.targets[0].values[0].index, index: c3.data.targets[0].values[0].index,
length: length, length: length,
duration: args.duration duration: args.duration,
onend: args.onend,
}, },
withLegend: true withLegend: true
}); });

4
c3.min.js vendored

File diff suppressed because one or more lines are too long

15
htdocs/samples/api_flow.html

@ -67,7 +67,16 @@
['data2', 100], ['data2', 100],
['data3', 200], ['data3', 200],
], ],
duration: 500 duration: 500,
onend: function () {
chart.flow({
columns: [
['data1', 200],
['data3', 100]
],
duration: 150
});
}
}); });
}, 1000); }, 1000);
@ -80,7 +89,7 @@
], ],
duration: 150 duration: 150
}); });
}, 2000); }, 3000);
setTimeout(function () { setTimeout(function () {
chart.flow({ chart.flow({
@ -90,7 +99,7 @@
['data3', 400] ['data3', 400]
] ]
}); });
}, 3000); }, 4000);
</script> </script>
</body> </body>

Loading…
Cancel
Save