Browse Source

make the changes asked

pull/2232/head
Prashant Patel 7 years ago
parent
commit
47bdff9899
  1. 1
      src/config.js
  2. 8
      src/legend.js

1
src/config.js

@ -91,6 +91,7 @@ c3_chart_internal_fn.getDefaultConfig = function () {
legend_padding: 0,
legend_item_tile_width: 10,
legend_item_tile_height: 10,
legend_format: undefined,
// axis
axis_rotated: false,
axis_x_show: true,

8
src/legend.js

@ -264,7 +264,13 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
}
});
l.append('text')
.text(function (id) { return isDefined(config.data_names[id]) ? config.data_names[id] : id; })
.text(function (id, index) {
if(config.legend_format && isFunction(config.legend_format)) {
return config.legend_format(id, index);
} else {
return isDefined(config.data_names[id]) ? config.data_names[id] : id;
}
})
.each(function (id, i) { updatePositions(this, id, i); })
.style("pointer-events", "none")
.attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200)

Loading…
Cancel
Save