Browse Source

Add duration to flow

pull/282/head
Masayuki Tanaka 11 years ago
parent
commit
75d9119a78
  1. 6
      c3.js
  2. 4
      c3.min.js
  3. 6
      htdocs/samples/api_flow.html

6
c3.js

@ -3943,6 +3943,7 @@
flowStart = getValueOnIndex(c3.data.targets[0].values, flowIndex), flowStart = getValueOnIndex(c3.data.targets[0].values, flowIndex),
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,
wait = generateWait(); wait = generateWait();
// remove head data after rendered // remove head data after rendered
@ -3961,7 +3962,7 @@
} }
transform = 'translate(' + translateX + ',0) scale(' + scaleX + ',1)'; transform = 'translate(' + translateX + ',0) scale(' + scaleX + ',1)';
d3.transition().ease('linear').each(function () { d3.transition().ease('linear').duration(durationForFlow).each(function () {
wait.add(axes.x.transition().call(xAxis)); wait.add(axes.x.transition().call(xAxis));
wait.add(mainBar.transition().attr('transform', transform)); wait.add(mainBar.transition().attr('transform', transform));
wait.add(mainLine.transition().attr('transform', transform)); wait.add(mainLine.transition().attr('transform', transform));
@ -4776,7 +4777,8 @@
redraw({ redraw({
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
}, },
withLegend: true withLegend: true
}); });

4
c3.min.js vendored

File diff suppressed because one or more lines are too long

6
htdocs/samples/api_flow.html

@ -66,7 +66,8 @@
['data1', 500], ['data1', 500],
['data2', 100], ['data2', 100],
['data3', 200], ['data3', 200],
] ],
duration: 500
}); });
}, 1000); }, 1000);
@ -76,7 +77,8 @@
['data1', 200], ['data1', 200],
// ['data2', 100], // ['data2', 100],
['data3', 100] ['data3', 100]
] ],
duration: 150
}); });
}, 2000); }, 2000);

Loading…
Cancel
Save