diff --git a/package.json b/package.json index d4430d9..4a1d505 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "frappe-charts", - "version": "2.0.0-rc23", + "version": "2.0.0-rc24", "main": "dist/frappe-charts.esm.js", "module": "dist/frappe-charts.esm.js", "browser": "dist/frappe-charts.umd.js", diff --git a/src/js/charts/AxisChart.js b/src/js/charts/AxisChart.js index f2e23de..ff18f3b 100644 --- a/src/js/charts/AxisChart.js +++ b/src/js/charts/AxisChart.js @@ -41,6 +41,7 @@ export default class AxisChart extends BaseChart { this.config.xIsSeries = options.axisOptions.xIsSeries || 0; this.config.shortenYAxisNumbers = options.axisOptions.shortenYAxisNumbers || 0; this.config.numberFormatter = options.axisOptions.numberFormatter; + this.config.seriesLabelSpaceRatio = options.axisOptions.seriesLabelSpaceRatio this.config.yAxisRange = options.axisOptions.yAxisRange || {}, @@ -216,7 +217,7 @@ export default class AxisChart extends BaseChart { function () { let s = this.state; s.xAxis.calcLabels = getShortenedLabels(this.width, - s.xAxis.labels, this.config.xIsSeries); + s.xAxis.labels, this.config.xIsSeries,this.config.seriesLabelSpaceRatio); return s.xAxis; }.bind(this) diff --git a/src/js/utils/axis-chart-utils.js b/src/js/utils/axis-chart-utils.js index 2a1a16d..ea08cc0 100644 --- a/src/js/utils/axis-chart-utils.js +++ b/src/js/utils/axis-chart-utils.js @@ -97,8 +97,8 @@ export function zeroDataPrep(realData) { return zeroData; } -export function getShortenedLabels(chartWidth, labels = [], isSeries = true) { - let allowedSpace = (chartWidth / labels.length) * SERIES_LABEL_SPACE_RATIO; +export function getShortenedLabels(chartWidth, labels = [], isSeries = true, seriesLabelSpaceRatio) { + let allowedSpace = (chartWidth / labels.length) * (seriesLabelSpaceRatio || SERIES_LABEL_SPACE_RATIO); if (allowedSpace <= 0) allowedSpace = 1; let allowedLetters = allowedSpace / DEFAULT_CHAR_WIDTH;