Browse Source

Update c3.js c3.min.js

pull/1344/head
Masayuki Tanaka 9 years ago
parent
commit
d551192ecc
  1. 21
      c3.js
  2. 6
      c3.min.js
  3. 30
      src/tooltip.js

21
c3.js

@ -3837,7 +3837,26 @@
titleFormat = config.tooltip_format_title || defaultTitleFormat,
nameFormat = config.tooltip_format_name || function (name) { return name; },
valueFormat = config.tooltip_format_value || defaultValueFormat,
text, i, title, value, name, bgcolor;
text, i, title, value, name, bgcolor,
orderAsc = $$.isOrderAsc();
if (config.data_groups.length === 0) {
d.sort(function(a,b){
return orderAsc ? a.value - b.value : b.value - a.value;
});
} else {
var ids = $$.orderTargets($$.data.targets).map(function (i) {
return i.id;
});
d.sort(function(a, b) {
if (a.value > 0 && b.value > 0) {
return orderAsc ? ids.indexOf(a.id) - ids.indexOf(b.id) : ids.indexOf(b.id) - ids.indexOf(a.id);
} else {
return orderAsc ? a.value - b.value : b.value - a.value;
}
});
}
for (i = 0; i < d.length; i++) {
if (! (d[i] && (d[i].value || d[i].value === 0))) { continue; }

6
c3.min.js vendored

File diff suppressed because one or more lines are too long

30
src/tooltip.js

@ -31,24 +31,24 @@ c3_chart_internal_fn.getTooltipContent = function (d, defaultTitleFormat, defaul
valueFormat = config.tooltip_format_value || defaultValueFormat,
text, i, title, value, name, bgcolor,
orderAsc = $$.isOrderAsc();
if (config.data_groups.length === 0) {
d.sort(function(a,b){
return orderAsc ? a.value - b.value : b.value - a.value;
});
} else {
var ids = $$.orderTargets($$.data.targets).map(function (i) {
return i.id;
});
d.sort(function(a, b) {
if (a.value > 0 && b.value > 0) {
return orderAsc ? ids.indexOf(a.id) - ids.indexOf(b.id) : ids.indexOf(b.id) - ids.indexOf(a.id);
} else {
d.sort(function(a,b){
return orderAsc ? a.value - b.value : b.value - a.value;
}
});
});
} else {
var ids = $$.orderTargets($$.data.targets).map(function (i) {
return i.id;
});
d.sort(function(a, b) {
if (a.value > 0 && b.value > 0) {
return orderAsc ? ids.indexOf(a.id) - ids.indexOf(b.id) : ids.indexOf(b.id) - ids.indexOf(a.id);
} else {
return orderAsc ? a.value - b.value : b.value - a.value;
}
});
}
for (i = 0; i < d.length; i++) {
if (! (d[i] && (d[i].value || d[i].value === 0))) { continue; }

Loading…
Cancel
Save