From 067f5ea7f8df890852ea21cc283d7766e41115fd Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 22 Feb 2021 03:17:07 +0000 Subject: [PATCH] feat: allow hiding legends --- src/js/charts/BaseChart.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/charts/BaseChart.js b/src/js/charts/BaseChart.js index 5482067..dd2d37c 100644 --- a/src/js/charts/BaseChart.js +++ b/src/js/charts/BaseChart.js @@ -35,7 +35,7 @@ export default class BaseChart { this.config = { showTooltip: 1, // calculate - showLegend: 1, // calculate + showLegend: (typeof options.showLegend !== 'undefined') ? options.showLegend : 1, isNavigable: options.isNavigable || 0, animate: (typeof options.animate !== 'undefined') ? options.animate : 1, truncateLegends: options.truncateLegends || 1 @@ -157,8 +157,10 @@ export default class BaseChart { this.data = this.realData; setTimeout(() => { this.update(this.data); }, this.initTimeout); } - - this.renderLegend(); + + if (this.config.showLegend) { + this.renderLegend(); + } this.setupNavigation(init); }