@diagrammo/dgmo 0.87.0 → 0.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.d.ts +6 -0
- package/dist/advanced.js +8 -6
- package/dist/block.js +3 -2
- package/dist/{chunk-FBKPSU3A.js → chunk-5LD7SHXO.js} +1 -1
- package/dist/{chunk-Q2U5635V.js → chunk-ABP5BUD6.js} +9 -430
- package/dist/{chunk-LPXC4I4R.js → chunk-JLETTWUJ.js} +12 -9
- package/dist/{chunk-AGO3PFGS.js → chunk-MVCPO6LI.js} +15 -10
- package/dist/{chunk-PJQZWJ5I.js → chunk-VW52W5F6.js} +934 -82
- package/dist/chunk-WXPBP4IT.js +438 -0
- package/dist/index.js +3 -2
- package/dist/{renderer-NX4YKWCJ.js → renderer-RNCYODNF.js} +1 -1
- package/dist/{renderer-3CTUWCO7.js → renderer-TPOZOAXR.js} +2 -2
- package/dist/{renderer-ELYPDPNF.js → renderer-XUPLAO4B.js} +2 -1
- package/package.json +1 -1
|
@@ -72,10 +72,10 @@ import * as d3Scale from "d3-scale";
|
|
|
72
72
|
import * as d3Selection from "d3-selection";
|
|
73
73
|
var BAR_H = 22;
|
|
74
74
|
var ROW_GAP = 6;
|
|
75
|
-
var GROUP_GAP = 14;
|
|
76
75
|
var MILESTONE_SIZE = 10;
|
|
77
76
|
var MIN_LEFT_MARGIN = 120;
|
|
78
77
|
var BOTTOM_MARGIN = 40;
|
|
78
|
+
var BOTTOM_AXIS_LABEL_RESERVE = 30;
|
|
79
79
|
var RIGHT_MARGIN = 20;
|
|
80
80
|
var LABEL_PAD = 8;
|
|
81
81
|
var LABEL_GAP = 5;
|
|
@@ -213,9 +213,11 @@ function renderGantt(container, resolved, palette, isDark, options, exportDims)
|
|
|
213
213
|
const ctx = exportDims ? ScaleContext.identity() : ScaleContext.from(containerWidth, idealWidth);
|
|
214
214
|
const sBarH = ctx.structural(BAR_H);
|
|
215
215
|
const sRowGap = ctx.structural(ROW_GAP);
|
|
216
|
-
const sGroupGap = ctx.structural(GROUP_GAP);
|
|
217
216
|
const sMilestoneSize = ctx.structural(MILESTONE_SIZE);
|
|
218
|
-
const sBottomMargin =
|
|
217
|
+
const sBottomMargin = Math.max(
|
|
218
|
+
ctx.aesthetic(BOTTOM_MARGIN),
|
|
219
|
+
BOTTOM_AXIS_LABEL_RESERVE
|
|
220
|
+
);
|
|
219
221
|
const sRightMargin = ctx.aesthetic(RIGHT_MARGIN);
|
|
220
222
|
const sLabelPad = ctx.structural(LABEL_PAD);
|
|
221
223
|
const sLabelGap = ctx.structural(LABEL_GAP);
|
|
@@ -225,10 +227,10 @@ function renderGantt(container, resolved, palette, isDark, options, exportDims)
|
|
|
225
227
|
const sTitleY = ctx.aesthetic(TITLE_Y);
|
|
226
228
|
const sHeaderRowH = ctx.structural(HEADER_ROW_H);
|
|
227
229
|
const sContentTopPad = ctx.aesthetic(CONTENT_TOP_PAD);
|
|
228
|
-
const sTopDateLabelReserve =
|
|
230
|
+
const sTopDateLabelReserve = topDateLabelReserve;
|
|
229
231
|
const sSprintLabelReserve = ctx.structural(sprintLabelReserve);
|
|
230
232
|
const sTitleHeight = ctx.aesthetic(titleHeight);
|
|
231
|
-
const sTagLegendReserve =
|
|
233
|
+
const sTagLegendReserve = tagLegendReserve;
|
|
232
234
|
const inlineRequested = resolved.options.legendInline === true && resolved.tagGroups.length > 0;
|
|
233
235
|
const legendExtent = inlineRequested ? getLegendExtent(
|
|
234
236
|
{
|
|
@@ -267,15 +269,17 @@ function renderGantt(container, resolved, palette, isDark, options, exportDims)
|
|
|
267
269
|
const sTodayLabelY = sTodayReserve ? -(sTopDateLabelReserve + sHeaderRowH / 2) : 0;
|
|
268
270
|
const sMarkerLabelY = sMarkerReserve ? -(sTopDateLabelReserve + sTodayReserve + sHeaderRowH / 2) : 0;
|
|
269
271
|
const sEraLabelY = sEraReserve ? -(sTopDateLabelReserve + sTodayReserve + sMarkerReserve + sHeaderRowH / 2) : 0;
|
|
270
|
-
const sContentH = isTagMode ? totalRows * (sBarH + sRowGap) : totalRows * (sBarH + sRowGap)
|
|
272
|
+
const sContentH = isTagMode ? totalRows * (sBarH + sRowGap) : totalRows * (sBarH + sRowGap);
|
|
271
273
|
const sInnerHeight = sContentTopPad + sContentH;
|
|
272
274
|
const sOuterHeight = sMarginTop + sInnerHeight + sBottomMargin;
|
|
273
275
|
const sprintRightPad = resolved.sprints.length > 0 ? 50 : 0;
|
|
274
|
-
const
|
|
275
|
-
const
|
|
276
|
+
const containerHeight = options?.fitToContainer ? container.clientHeight : 0;
|
|
277
|
+
const layoutWidth = !exportDims && containerHeight > 0 && sOuterHeight > containerHeight ? containerWidth * sOuterHeight / containerHeight : containerWidth;
|
|
278
|
+
const innerWidth = layoutWidth - leftMargin - sRightMargin - sprintRightPad;
|
|
279
|
+
const svg = d3Selection.select(container).append("svg").attr("viewBox", `0 0 ${layoutWidth} ${sOuterHeight}`).attr("width", exportDims ? containerWidth : "100%").attr("preserveAspectRatio", "xMidYMin meet").attr("font-family", FONT_FAMILY).style("overflow", "visible");
|
|
276
280
|
const g = svg.append("g").attr("transform", `translate(${leftMargin}, ${sMarginTop})`);
|
|
277
281
|
if (showTitle) {
|
|
278
|
-
svg.append("text").attr("class", "chart-title").attr("x", header.titleX).attr("y", sTitleY).attr("text-anchor", header.titleAnchor).attr("font-size", sTitleFontSize).attr("font-weight", TITLE_FONT_WEIGHT).attr("fill", palette.text).text(title);
|
|
282
|
+
svg.append("text").attr("class", "chart-title").attr("x", header.inline ? header.titleX : layoutWidth / 2).attr("y", sTitleY).attr("text-anchor", header.titleAnchor).attr("font-size", sTitleFontSize).attr("font-weight", TITLE_FONT_WEIGHT).attr("fill", palette.text).text(title);
|
|
279
283
|
}
|
|
280
284
|
function drawLegend() {
|
|
281
285
|
svg.selectAll(".gantt-tag-legend-container").remove();
|
|
@@ -362,7 +366,8 @@ function renderGantt(container, resolved, palette, isDark, options, exportDims)
|
|
|
362
366
|
drawLegend();
|
|
363
367
|
const startTime = dateToFractionalYear(resolved.startDate);
|
|
364
368
|
const endTime = dateToFractionalYear(resolved.endDate);
|
|
365
|
-
const
|
|
369
|
+
const span = endTime - startTime;
|
|
370
|
+
const domainPad = span > 0 ? span * 0.02 : 1 / 365;
|
|
366
371
|
const domainMin = startTime - domainPad;
|
|
367
372
|
const domainMax = endTime + domainPad;
|
|
368
373
|
const xScale = d3Scale.scaleLinear().domain([domainMin, domainMax]).range([0, innerWidth]);
|