Commit b0e78535 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix legend item width when data.names called - #775

parent 57dbe886
...@@ -3766,6 +3766,9 @@ ...@@ -3766,6 +3766,9 @@
.style('visibility', 'hidden'); .style('visibility', 'hidden');
}; };
var legendItemTextBox = {}; var legendItemTextBox = {};
c3_chart_internal_fn.clearLegendItemTextBoxCache = function () {
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;
var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect; var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect;
...@@ -6273,6 +6276,7 @@ ...@@ -6273,6 +6276,7 @@
return values; return values;
}; };
c3_chart_fn.data.names = function (names) { c3_chart_fn.data.names = function (names) {
this.internal.clearLegendItemTextBoxCache();
return this.internal.updateDataAttributes('names', names); return this.internal.updateDataAttributes('names', names);
}; };
c3_chart_fn.data.colors = function (colors) { c3_chart_fn.data.colors = function (colors) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -16,6 +16,7 @@ c3_chart_fn.data.values = function (targetId) { ...@@ -16,6 +16,7 @@ c3_chart_fn.data.values = function (targetId) {
return values; return values;
}; };
c3_chart_fn.data.names = function (names) { c3_chart_fn.data.names = function (names) {
this.internal.clearLegendItemTextBoxCache();
return this.internal.updateDataAttributes('names', names); return this.internal.updateDataAttributes('names', names);
}; };
c3_chart_fn.data.colors = function (colors) { c3_chart_fn.data.colors = function (colors) {
......
...@@ -100,6 +100,9 @@ c3_chart_internal_fn.hideLegend = function (targetIds) { ...@@ -100,6 +100,9 @@ c3_chart_internal_fn.hideLegend = function (targetIds) {
.style('visibility', 'hidden'); .style('visibility', 'hidden');
}; };
var legendItemTextBox = {}; var legendItemTextBox = {};
c3_chart_internal_fn.clearLegendItemTextBoxCache = function () {
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;
var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect; var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect;
......
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