|
|
@ -1,5 +1,6 @@ |
|
|
|
c3_chart_internal_fn.initLegend = function () { |
|
|
|
c3_chart_internal_fn.initLegend = function () { |
|
|
|
var $$ = this; |
|
|
|
var $$ = this; |
|
|
|
|
|
|
|
$$.legendItemTextBox = {}; |
|
|
|
$$.legendHasRendered = false; |
|
|
|
$$.legendHasRendered = false; |
|
|
|
$$.legend = $$.svg.append("g").attr("transform", $$.getTranslate('legend')); |
|
|
|
$$.legend = $$.svg.append("g").attr("transform", $$.getTranslate('legend')); |
|
|
|
if (!$$.config.legend_show) { |
|
|
|
if (!$$.config.legend_show) { |
|
|
@ -107,9 +108,8 @@ c3_chart_internal_fn.hideLegend = function (targetIds) { |
|
|
|
.style('opacity', 0) |
|
|
|
.style('opacity', 0) |
|
|
|
.style('visibility', 'hidden'); |
|
|
|
.style('visibility', 'hidden'); |
|
|
|
}; |
|
|
|
}; |
|
|
|
var legendItemTextBox = {}; |
|
|
|
|
|
|
|
c3_chart_internal_fn.clearLegendItemTextBoxCache = function () { |
|
|
|
c3_chart_internal_fn.clearLegendItemTextBoxCache = function () { |
|
|
|
legendItemTextBox = {}; |
|
|
|
this.legendItemTextBox = {}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) { |
|
|
|
c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) { |
|
|
|
var $$ = this, config = $$.config; |
|
|
|
var $$ = this, config = $$.config; |
|
|
@ -124,10 +124,10 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) { |
|
|
|
withTransitionForTransform = getOption(options, "withTransitionForTransform", true); |
|
|
|
withTransitionForTransform = getOption(options, "withTransitionForTransform", true); |
|
|
|
|
|
|
|
|
|
|
|
function getTextBox(textElement, id) { |
|
|
|
function getTextBox(textElement, id) { |
|
|
|
if (!legendItemTextBox[id]) { |
|
|
|
if (!$$.legendItemTextBox[id]) { |
|
|
|
legendItemTextBox[id] = $$.getTextRect(textElement.textContent, CLASS.legendItem); |
|
|
|
$$.legendItemTextBox[id] = $$.getTextRect(textElement.textContent, CLASS.legendItem); |
|
|
|
} |
|
|
|
} |
|
|
|
return legendItemTextBox[id]; |
|
|
|
return $$.legendItemTextBox[id]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function updatePositions(textElement, id, index) { |
|
|
|
function updatePositions(textElement, id, index) { |
|
|
|