Commit b2859dd0 authored by Evgeny's avatar Evgeny

Add legend.position

parent 922958be
...@@ -6,6 +6,29 @@ c3_chart_fn.legend.show = function (targetIds) { ...@@ -6,6 +6,29 @@ c3_chart_fn.legend.show = function (targetIds) {
}; };
c3_chart_fn.legend.hide = function (targetIds) { c3_chart_fn.legend.hide = function (targetIds) {
var $$ = this.internal; var $$ = this.internal;
$$.hideLegend($$.mapToTargetIds(targetIds)); $$.hideLegend(targetIds);
$$.updateAndRedraw({withLegend: true}); $$.updateAndRedraw({withLegend: true});
}; };
c3_chart_fn.legend.position = function(position) {
var $$ = this.internal;
if (!arguments.length) {
if (!$$.config.legend_show) {
position = 'off';
} else if ($$.isLegendRight) {
position = 'right';
} else if ($$.isLegendInset) {
position = 'inset';
} else {
position = 'bottom';
}
return position;
}
$$.isLegendRight = position === 'right';
$$.isLegendInset = position === 'inset';
$$.cachedRedraw({withLegend: true});
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment