diff --git a/src/modules/Graphics.js b/src/modules/Graphics.js index 0bb1e5b50..acfaf85e4 100644 --- a/src/modules/Graphics.js +++ b/src/modules/Graphics.js @@ -449,6 +449,7 @@ class Graphics { textAnchor, fontSize, fontFamily, + fontWeight, foreColor, opacity } = opts @@ -463,6 +464,7 @@ class Graphics { foreColor = w.config.chart.foreColor } fontFamily = fontFamily || w.config.chart.fontFamily + fontWeight = fontWeight || 'regular' let elText if (Array.isArray(text)) { @@ -482,6 +484,7 @@ class Graphics { 'dominant-baseline': 'auto', 'font-size': fontSize, 'font-family': fontFamily, + 'font-weight': fontWeight, fill: foreColor, class: 'apexcharts-text ' + opts.cssClass ? opts.cssClass : '' }) diff --git a/src/modules/axes/AxesUtils.js b/src/modules/axes/AxesUtils.js index 116755251..9e6880fa2 100644 --- a/src/modules/axes/AxesUtils.js +++ b/src/modules/axes/AxesUtils.js @@ -16,6 +16,8 @@ export default class AxesUtils { let xlbFormatter = w.globals.xLabelFormatter let customFormatter = w.config.xaxis.labels.formatter + let isBold = false + let xFormat = new Formatters(this.ctx) let timestamp = rawLabel label = xFormat.xLabelFormat(xlbFormatter, rawLabel, timestamp) @@ -24,7 +26,24 @@ export default class AxesUtils { label = customFormatter(rawLabel, labels[i], i) } + const determineHighestUnit = (unit) => { + let highestUnit = null + timelineLabels.forEach((t) => { + if (t.unit === 'month') { + highestUnit = 'year' + } else if (t.unit === 'day') { + highestUnit = 'month' + } else if (t.unit === 'hour') { + highestUnit = 'day' + } else if (t.unit === 'minute') { + highestUnit = 'hour' + } + }) + + return highestUnit === unit + } if (timelineLabels.length > 0) { + isBold = determineHighestUnit(timelineLabels[i].unit) x = timelineLabels[i].position label = timelineLabels[i].value } else { @@ -48,7 +67,8 @@ export default class AxesUtils { return { x, - text: label + text: label, + isBold } } diff --git a/src/modules/axes/XAxis.js b/src/modules/axes/XAxis.js index 8ecbae809..e8845aa56 100644 --- a/src/modules/axes/XAxis.js +++ b/src/modules/axes/XAxis.js @@ -110,6 +110,7 @@ export default class XAxis { y: this.offY + w.config.xaxis.labels.offsetY + offsetYCorrection, text: '', textAnchor: 'middle', + fontWeight: label.isBold ? 600 : 400, fontSize: this.xaxisFontSize, fontFamily: this.xaxisFontFamily, foreColor: Array.isArray(this.xaxisForeColors)