Browse Source

Merge branch 'singleSelection' of https://github.com/hotzenklotz/c3 into hotzenklotz-singleSelection

pull/80/head
Masayuki Tanaka 11 years ago
parent
commit
fd96a8e170
  1. 9
      c3.js
  2. 4
      c3.min.js
  3. 26
      htdocs/samples/selection_line.html

9
c3.js

@ -65,7 +65,9 @@
__data_colors = getConfig(['data', 'colors'], {}),
__data_selection_enabled = getConfig(['data', 'selection', 'enabled'], false),
__data_selection_grouped = getConfig(['data', 'selection', 'grouped'], false),
__data_selection_isselectable = getConfig(['data', 'selection', 'isselectable'], function () { return true; });
__data_selection_isselectable = getConfig(['data', 'selection', 'isselectable'], function () { return true; }),
__data_selection_multiselected = getConfig(['data', 'selection', 'multiselected'], true);
// subchart
var __subchart_show = getConfig(['subchart', 'show'], false),
@ -2177,6 +2179,11 @@
}
if (__data_selection_grouped || isWithin) {
if (__data_selection_enabled && __data_selection_isselectable(d)) {
if (!__data_selection_multiselected) {
main.selectAll(target.nodeName).each(function (d, i) {
toggle(false, this, d, i);
});
}
_this.classed(SELECTED, !isSelected);
toggle(!isSelected, _this, d, i);
}

4
c3.min.js vendored

File diff suppressed because one or more lines are too long

26
htdocs/samples/selection_line.html

@ -0,0 +1,26 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="/css/c3.css">
</head>
<body>
<div id="chart"></div>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="/js/c3.js"></script>
<script>
var chart = c3.generate({
bindto: '#chart',
data: {
columns: [
['sample', 30, 200, 100, 400, 150, 250]
],
selection: {
enabled: true,
grouped: true,
multiselected: false
}
}
});
</script>
</body>
</html>
Loading…
Cancel
Save