From f78d4b13eb411cd5604769ca70f2a9e6b90bba0e Mon Sep 17 00:00:00 2001 From: Nishanth Aravamudan Date: Wed, 24 Mar 2021 11:38:21 -0500 Subject: [PATCH] gantt: only display topAxis if configured or directive is set --- src/diagrams/gantt/ganttRenderer.js | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/diagrams/gantt/ganttRenderer.js b/src/diagrams/gantt/ganttRenderer.js index d8ee9bb06..56dfe4362 100644 --- a/src/diagrams/gantt/ganttRenderer.js +++ b/src/diagrams/gantt/ganttRenderer.js @@ -371,21 +371,23 @@ export const draw = function(text, id) { .attr('font-size', 10) .attr('dy', '1em'); - let topXAxis = axisTop(timeScale) - .tickSize(-h + theTopPad + conf.gridLineStartPadding) - .tickFormat(timeFormat(parser.yy.getAxisFormat() || conf.axisFormat || '%Y-%m-%d')); + if (ganttDb.topAxisEnabled() || conf.topAxis) { + let topXAxis = axisTop(timeScale) + .tickSize(-h + theTopPad + conf.gridLineStartPadding) + .tickFormat(timeFormat(parser.yy.getAxisFormat() || conf.axisFormat || '%Y-%m-%d')); - svg - .append('g') - .attr('class', 'grid') - .attr('transform', 'translate(' + theSidePad + ', ' + (h - 50) + ')') - .call(topXAxis) - .selectAll('text') - .style('text-anchor', 'middle') - .attr('fill', '#000') - .attr('stroke', 'none') - .attr('font-size', 10) - .attr('dy', '1em'); + svg + .append('g') + .attr('class', 'grid') + .attr('transform', 'translate(' + theSidePad + ', ' + (h - 50) + ')') + .call(topXAxis) + .selectAll('text') + .style('text-anchor', 'middle') + .attr('fill', '#000') + .attr('stroke', 'none') + .attr('font-size', 10) + .attr('dy', '1em'); + } } function vertLabels(theGap, theTopPad) {