Browse Source

Merge branch 'master' of github.com:masayuki0812/c3

pull/1177/merge
Masayuki Tanaka 10 years ago
parent
commit
ed60f60360
  1. 12
      spec/grid-spec.js
  2. 16
      src/legend.js

12
spec/grid-spec.js

@ -91,9 +91,9 @@ describe('c3 chart grid', function () {
grid: {
y: {
lines: [
{value: 30, text: 'Lable 30', position: 'start'},
{value: 145, text: 'Lable 145', position: 'middle'},
{value: 225, text: 'Lable 225'}
{value: 30, text: 'Label 30', position: 'start'},
{value: 145, text: 'Label 145', position: 'middle'},
{value: 225, text: 'Label 225'}
]
}
}
@ -140,9 +140,9 @@ describe('c3 chart grid', function () {
grid: {
y: {
lines: [
{value: 30, text: 'Lable 30', position: 'start'},
{value: 145, text: 'Lable 145', position: 'middle'},
{value: 225, text: 'Lable 225'}
{value: 30, text: 'Label 30', position: 'start'},
{value: 145, text: 'Label 145', position: 'middle'},
{value: 225, text: 'Label 225'}
]
}
}

16
src/legend.js

@ -240,20 +240,24 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
}
})
.on('mouseover', function (id) {
$$.d3.select(this).classed(CLASS.legendItemFocused, true);
if (!$$.transiting && $$.isTargetToShow(id)) {
$$.api.focus(id);
}
if (config.legend_item_onmouseover) {
config.legend_item_onmouseover.call($$, id);
}
else {
$$.d3.select(this).classed(CLASS.legendItemFocused, true);
if (!$$.transiting && $$.isTargetToShow(id)) {
$$.api.focus(id);
}
}
})
.on('mouseout', function (id) {
$$.d3.select(this).classed(CLASS.legendItemFocused, false);
$$.api.revert();
if (config.legend_item_onmouseout) {
config.legend_item_onmouseout.call($$, id);
}
else {
$$.d3.select(this).classed(CLASS.legendItemFocused, false);
$$.api.revert();
}
});
l.append('text')
.text(function (id) { return isDefined(config.data_names[id]) ? config.data_names[id] : id; })

Loading…
Cancel
Save