Browse Source

Add onend callback for flow

pull/282/head
Masayuki Tanaka 10 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),
orgDomain = x.domain(),
durationForFlow = options.flow.duration || duration,
onend = options.flow.onend || function () {},
wait = generateWait();
// remove head data after rendered
@ -4025,8 +4026,8 @@
.attr("width", __axis_rotated ? width : rectW)
.attr("height", __axis_rotated ? rectW : height);
// callback here?
// callback for end of flow
onend();
});
} : null);
@ -4778,7 +4779,8 @@
flow: {
index: c3.data.targets[0].values[0].index,
length: length,
duration: args.duration
duration: args.duration,
onend: args.onend,
},
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],
['data3', 200],
],
duration: 500
duration: 500,
onend: function () {
chart.flow({
columns: [
['data1', 200],
['data3', 100]
],
duration: 150
});
}
});
}, 1000);
@ -80,7 +89,7 @@
],
duration: 150
});
}, 2000);
}, 3000);
setTimeout(function () {
chart.flow({
@ -90,7 +99,7 @@
['data3', 400]
]
});
}, 3000);
}, 4000);
</script>
</body>

Loading…
Cancel
Save