@diagrammo/dgmo 0.2.8 → 0.2.9
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/cli.cjs +52 -52
- package/dist/index.cjs +120 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +120 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/chart.ts +2 -0
- package/src/d3.ts +118 -9
- package/src/echarts.ts +2 -0
- package/src/graph/flowchart-parser.ts +1 -0
- package/src/graph/flowchart-renderer.ts +15 -4
- package/src/graph/types.ts +1 -0
- package/src/sequence/parser.ts +3 -0
- package/src/sequence/renderer.ts +6 -1
package/dist/index.d.cts
CHANGED
|
@@ -171,6 +171,7 @@ interface ChartDataPoint {
|
|
|
171
171
|
interface ParsedChart {
|
|
172
172
|
type: ChartType;
|
|
173
173
|
title?: string;
|
|
174
|
+
titleLineNumber?: number;
|
|
174
175
|
series?: string;
|
|
175
176
|
xlabel?: string;
|
|
176
177
|
ylabel?: string;
|
|
@@ -235,6 +236,7 @@ interface ParsedHeatmapRow {
|
|
|
235
236
|
interface ParsedEChart {
|
|
236
237
|
type: EChartsChartType;
|
|
237
238
|
title?: string;
|
|
239
|
+
titleLineNumber?: number;
|
|
238
240
|
series?: string;
|
|
239
241
|
seriesNames?: string[];
|
|
240
242
|
seriesNameColors?: (string | undefined)[];
|
|
@@ -384,6 +386,7 @@ interface D3ExportDimensions {
|
|
|
384
386
|
interface ParsedD3 {
|
|
385
387
|
type: D3ChartType | null;
|
|
386
388
|
title: string | null;
|
|
389
|
+
titleLineNumber: number | null;
|
|
387
390
|
orientation: 'horizontal' | 'vertical';
|
|
388
391
|
periods: string[];
|
|
389
392
|
data: D3DataItem[];
|
|
@@ -565,6 +568,7 @@ interface SequenceGroup {
|
|
|
565
568
|
*/
|
|
566
569
|
interface ParsedSequenceDgmo {
|
|
567
570
|
title: string | null;
|
|
571
|
+
titleLineNumber: number | null;
|
|
568
572
|
participants: SequenceParticipant[];
|
|
569
573
|
messages: SequenceMessage[];
|
|
570
574
|
elements: SequenceElement[];
|
|
@@ -661,6 +665,7 @@ interface GraphGroup {
|
|
|
661
665
|
interface ParsedGraph {
|
|
662
666
|
type: 'flowchart';
|
|
663
667
|
title?: string;
|
|
668
|
+
titleLineNumber?: number;
|
|
664
669
|
direction: GraphDirection;
|
|
665
670
|
nodes: GraphNode[];
|
|
666
671
|
edges: GraphEdge[];
|
package/dist/index.d.ts
CHANGED
|
@@ -171,6 +171,7 @@ interface ChartDataPoint {
|
|
|
171
171
|
interface ParsedChart {
|
|
172
172
|
type: ChartType;
|
|
173
173
|
title?: string;
|
|
174
|
+
titleLineNumber?: number;
|
|
174
175
|
series?: string;
|
|
175
176
|
xlabel?: string;
|
|
176
177
|
ylabel?: string;
|
|
@@ -235,6 +236,7 @@ interface ParsedHeatmapRow {
|
|
|
235
236
|
interface ParsedEChart {
|
|
236
237
|
type: EChartsChartType;
|
|
237
238
|
title?: string;
|
|
239
|
+
titleLineNumber?: number;
|
|
238
240
|
series?: string;
|
|
239
241
|
seriesNames?: string[];
|
|
240
242
|
seriesNameColors?: (string | undefined)[];
|
|
@@ -384,6 +386,7 @@ interface D3ExportDimensions {
|
|
|
384
386
|
interface ParsedD3 {
|
|
385
387
|
type: D3ChartType | null;
|
|
386
388
|
title: string | null;
|
|
389
|
+
titleLineNumber: number | null;
|
|
387
390
|
orientation: 'horizontal' | 'vertical';
|
|
388
391
|
periods: string[];
|
|
389
392
|
data: D3DataItem[];
|
|
@@ -565,6 +568,7 @@ interface SequenceGroup {
|
|
|
565
568
|
*/
|
|
566
569
|
interface ParsedSequenceDgmo {
|
|
567
570
|
title: string | null;
|
|
571
|
+
titleLineNumber: number | null;
|
|
568
572
|
participants: SequenceParticipant[];
|
|
569
573
|
messages: SequenceMessage[];
|
|
570
574
|
elements: SequenceElement[];
|
|
@@ -661,6 +665,7 @@ interface GraphGroup {
|
|
|
661
665
|
interface ParsedGraph {
|
|
662
666
|
type: 'flowchart';
|
|
663
667
|
title?: string;
|
|
668
|
+
titleLineNumber?: number;
|
|
664
669
|
direction: GraphDirection;
|
|
665
670
|
nodes: GraphNode[];
|
|
666
671
|
edges: GraphEdge[];
|
package/dist/index.js
CHANGED
|
@@ -196,6 +196,7 @@ function measureIndent(line3) {
|
|
|
196
196
|
function parseSequenceDgmo(content) {
|
|
197
197
|
const result = {
|
|
198
198
|
title: null,
|
|
199
|
+
titleLineNumber: null,
|
|
199
200
|
participants: [],
|
|
200
201
|
messages: [],
|
|
201
202
|
elements: [],
|
|
@@ -299,6 +300,7 @@ function parseSequenceDgmo(content) {
|
|
|
299
300
|
}
|
|
300
301
|
if (key === "title") {
|
|
301
302
|
result.title = value;
|
|
303
|
+
result.titleLineNumber = lineNumber;
|
|
302
304
|
continue;
|
|
303
305
|
}
|
|
304
306
|
result.options[key] = value;
|
|
@@ -967,6 +969,7 @@ function parseFlowchart(content, palette) {
|
|
|
967
969
|
}
|
|
968
970
|
if (key === "title") {
|
|
969
971
|
result.title = value;
|
|
972
|
+
result.titleLineNumber = lineNumber;
|
|
970
973
|
continue;
|
|
971
974
|
}
|
|
972
975
|
if (key === "direction") {
|
|
@@ -2405,7 +2408,7 @@ function renderFlowchart(container, graph, layout, palette, isDark, onClickItem,
|
|
|
2405
2408
|
const scaledH = diagramH * scale;
|
|
2406
2409
|
const offsetX = (width - scaledW) / 2;
|
|
2407
2410
|
const offsetY = (height - scaledH) / 2;
|
|
2408
|
-
const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", height).style("
|
|
2411
|
+
const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", height).style("font-family", FONT_FAMILY);
|
|
2409
2412
|
const defs = svg.append("defs");
|
|
2410
2413
|
defs.append("marker").attr("id", "fc-arrow").attr("viewBox", `0 0 ${ARROWHEAD_W} ${ARROWHEAD_H}`).attr("refX", ARROWHEAD_W).attr("refY", ARROWHEAD_H / 2).attr("markerWidth", ARROWHEAD_W).attr("markerHeight", ARROWHEAD_H).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W},${ARROWHEAD_H / 2} 0,${ARROWHEAD_H}`).attr("fill", palette.textMuted);
|
|
2411
2414
|
const edgeColors = /* @__PURE__ */ new Set();
|
|
@@ -2418,7 +2421,17 @@ function renderFlowchart(container, graph, layout, palette, isDark, onClickItem,
|
|
|
2418
2421
|
}
|
|
2419
2422
|
const mainG = svg.append("g").attr("transform", `translate(${offsetX}, ${offsetY}) scale(${scale})`);
|
|
2420
2423
|
if (graph.title) {
|
|
2421
|
-
mainG.append("text").attr("x", diagramW / 2).attr("y", TITLE_FONT_SIZE).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-size", TITLE_FONT_SIZE).attr("font-weight", "bold").attr("class", "fc-title").text(graph.title);
|
|
2424
|
+
const titleEl = mainG.append("text").attr("x", diagramW / 2).attr("y", TITLE_FONT_SIZE).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-size", TITLE_FONT_SIZE).attr("font-weight", "bold").attr("class", "fc-title chart-title").style("cursor", onClickItem && graph.titleLineNumber ? "pointer" : "default").text(graph.title);
|
|
2425
|
+
if (graph.titleLineNumber) {
|
|
2426
|
+
titleEl.attr("data-line-number", graph.titleLineNumber);
|
|
2427
|
+
if (onClickItem) {
|
|
2428
|
+
titleEl.on("click", () => onClickItem(graph.titleLineNumber)).on("mouseenter", function() {
|
|
2429
|
+
d3Selection.select(this).attr("opacity", 0.7);
|
|
2430
|
+
}).on("mouseleave", function() {
|
|
2431
|
+
d3Selection.select(this).attr("opacity", 1);
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2422
2435
|
}
|
|
2423
2436
|
const contentG = mainG.append("g").attr("transform", `translate(0, ${titleOffset})`);
|
|
2424
2437
|
for (const group of layout.groups) {
|
|
@@ -2452,7 +2465,7 @@ function renderFlowchart(container, graph, layout, palette, isDark, onClickItem,
|
|
|
2452
2465
|
}
|
|
2453
2466
|
}
|
|
2454
2467
|
for (const node of layout.nodes) {
|
|
2455
|
-
const nodeG = contentG.append("g").attr("transform", `translate(${node.x}, ${node.y})`).attr("class", "fc-node").attr("data-line-number", String(node.lineNumber));
|
|
2468
|
+
const nodeG = contentG.append("g").attr("transform", `translate(${node.x}, ${node.y})`).attr("class", "fc-node").attr("data-line-number", String(node.lineNumber)).attr("data-node-id", node.id);
|
|
2456
2469
|
if (onClickItem) {
|
|
2457
2470
|
nodeG.style("cursor", "pointer").on("click", () => {
|
|
2458
2471
|
onClickItem(node.lineNumber);
|
|
@@ -3143,7 +3156,10 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
3143
3156
|
`0,0 ${ARROWHEAD_SIZE},${ARROWHEAD_SIZE / 2} 0,${ARROWHEAD_SIZE}`
|
|
3144
3157
|
).attr("fill", "none").attr("stroke", palette.text).attr("stroke-width", 1.2);
|
|
3145
3158
|
if (title) {
|
|
3146
|
-
svg.append("text").attr("x", svgWidth / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-size", 20).attr("font-weight", "bold").text(title);
|
|
3159
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", svgWidth / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-size", 20).attr("font-weight", "bold").text(title);
|
|
3160
|
+
if (parsed.titleLineNumber) {
|
|
3161
|
+
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
3162
|
+
}
|
|
3147
3163
|
}
|
|
3148
3164
|
for (const group of groups) {
|
|
3149
3165
|
if (group.participantIds.length === 0) continue;
|
|
@@ -3662,6 +3678,7 @@ function parseChart(content, palette) {
|
|
|
3662
3678
|
}
|
|
3663
3679
|
if (key === "title") {
|
|
3664
3680
|
result.title = value;
|
|
3681
|
+
result.titleLineNumber = lineNumber;
|
|
3665
3682
|
continue;
|
|
3666
3683
|
}
|
|
3667
3684
|
if (key === "xlabel") {
|
|
@@ -3803,6 +3820,7 @@ function parseEChart(content, palette) {
|
|
|
3803
3820
|
}
|
|
3804
3821
|
if (key === "title") {
|
|
3805
3822
|
result.title = value;
|
|
3823
|
+
result.titleLineNumber = lineNumber;
|
|
3806
3824
|
continue;
|
|
3807
3825
|
}
|
|
3808
3826
|
if (key === "series") {
|
|
@@ -5164,6 +5182,7 @@ function parseD3(content, palette) {
|
|
|
5164
5182
|
const result = {
|
|
5165
5183
|
type: null,
|
|
5166
5184
|
title: null,
|
|
5185
|
+
titleLineNumber: null,
|
|
5167
5186
|
orientation: "horizontal",
|
|
5168
5187
|
periods: [],
|
|
5169
5188
|
data: [],
|
|
@@ -5425,6 +5444,7 @@ function parseD3(content, palette) {
|
|
|
5425
5444
|
}
|
|
5426
5445
|
if (key === "title") {
|
|
5427
5446
|
result.title = line3.substring(colonIndex + 1).trim();
|
|
5447
|
+
result.titleLineNumber = lineNumber;
|
|
5428
5448
|
if (result.type === "quadrant") {
|
|
5429
5449
|
result.quadrantTitleLineNumber = lineNumber;
|
|
5430
5450
|
}
|
|
@@ -5787,7 +5807,17 @@ function renderSlopeChart(container, parsed, palette, isDark, onClickItem, expor
|
|
|
5787
5807
|
const g = svg.append("g").attr("transform", `translate(${SLOPE_MARGIN.left},${SLOPE_MARGIN.top})`);
|
|
5788
5808
|
const tooltip = createTooltip(container, palette, isDark);
|
|
5789
5809
|
if (title) {
|
|
5790
|
-
svg.append("text").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
5810
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
5811
|
+
if (parsed.titleLineNumber) {
|
|
5812
|
+
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
5813
|
+
if (onClickItem) {
|
|
5814
|
+
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
5815
|
+
d3Selection3.select(this).attr("opacity", 0.7);
|
|
5816
|
+
}).on("mouseleave", function() {
|
|
5817
|
+
d3Selection3.select(this).attr("opacity", 1);
|
|
5818
|
+
});
|
|
5819
|
+
}
|
|
5820
|
+
}
|
|
5791
5821
|
}
|
|
5792
5822
|
for (const period of periods) {
|
|
5793
5823
|
const x = xScale(period);
|
|
@@ -5996,7 +6026,17 @@ function renderArcDiagram(container, parsed, palette, _isDark, onClickItem, expo
|
|
|
5996
6026
|
const svg = d3Selection3.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
5997
6027
|
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
5998
6028
|
if (title) {
|
|
5999
|
-
svg.append("text").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
6029
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
6030
|
+
if (parsed.titleLineNumber) {
|
|
6031
|
+
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
6032
|
+
if (onClickItem) {
|
|
6033
|
+
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
6034
|
+
d3Selection3.select(this).attr("opacity", 0.7);
|
|
6035
|
+
}).on("mouseleave", function() {
|
|
6036
|
+
d3Selection3.select(this).attr("opacity", 1);
|
|
6037
|
+
});
|
|
6038
|
+
}
|
|
6039
|
+
}
|
|
6000
6040
|
}
|
|
6001
6041
|
const neighbors = /* @__PURE__ */ new Map();
|
|
6002
6042
|
for (const node of nodes) neighbors.set(node, /* @__PURE__ */ new Set());
|
|
@@ -6548,7 +6588,17 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
6548
6588
|
const svg = d3Selection3.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
6549
6589
|
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
6550
6590
|
if (title) {
|
|
6551
|
-
svg.append("text").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
6591
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
6592
|
+
if (parsed.titleLineNumber) {
|
|
6593
|
+
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
6594
|
+
if (onClickItem) {
|
|
6595
|
+
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
6596
|
+
d3Selection3.select(this).attr("opacity", 0.7);
|
|
6597
|
+
}).on("mouseleave", function() {
|
|
6598
|
+
d3Selection3.select(this).attr("opacity", 1);
|
|
6599
|
+
});
|
|
6600
|
+
}
|
|
6601
|
+
}
|
|
6552
6602
|
}
|
|
6553
6603
|
renderEras(
|
|
6554
6604
|
g,
|
|
@@ -6642,7 +6692,17 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
6642
6692
|
const svg = d3Selection3.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
6643
6693
|
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
6644
6694
|
if (title) {
|
|
6645
|
-
svg.append("text").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
6695
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
6696
|
+
if (parsed.titleLineNumber) {
|
|
6697
|
+
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
6698
|
+
if (onClickItem) {
|
|
6699
|
+
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
6700
|
+
d3Selection3.select(this).attr("opacity", 0.7);
|
|
6701
|
+
}).on("mouseleave", function() {
|
|
6702
|
+
d3Selection3.select(this).attr("opacity", 1);
|
|
6703
|
+
});
|
|
6704
|
+
}
|
|
6705
|
+
}
|
|
6646
6706
|
}
|
|
6647
6707
|
renderEras(
|
|
6648
6708
|
g,
|
|
@@ -6765,7 +6825,17 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
6765
6825
|
const svg = d3Selection3.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
6766
6826
|
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
6767
6827
|
if (title) {
|
|
6768
|
-
svg.append("text").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
6828
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
6829
|
+
if (parsed.titleLineNumber) {
|
|
6830
|
+
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
6831
|
+
if (onClickItem) {
|
|
6832
|
+
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
6833
|
+
d3Selection3.select(this).attr("opacity", 0.7);
|
|
6834
|
+
}).on("mouseleave", function() {
|
|
6835
|
+
d3Selection3.select(this).attr("opacity", 1);
|
|
6836
|
+
});
|
|
6837
|
+
}
|
|
6838
|
+
}
|
|
6769
6839
|
}
|
|
6770
6840
|
renderEras(
|
|
6771
6841
|
g,
|
|
@@ -6910,7 +6980,17 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
6910
6980
|
const svg = d3Selection3.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
6911
6981
|
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
6912
6982
|
if (title) {
|
|
6913
|
-
svg.append("text").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
6983
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
6984
|
+
if (parsed.titleLineNumber) {
|
|
6985
|
+
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
6986
|
+
if (onClickItem) {
|
|
6987
|
+
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
6988
|
+
d3Selection3.select(this).attr("opacity", 0.7);
|
|
6989
|
+
}).on("mouseleave", function() {
|
|
6990
|
+
d3Selection3.select(this).attr("opacity", 1);
|
|
6991
|
+
});
|
|
6992
|
+
}
|
|
6993
|
+
}
|
|
6914
6994
|
}
|
|
6915
6995
|
renderEras(
|
|
6916
6996
|
g,
|
|
@@ -7061,7 +7141,17 @@ function renderWordCloud(container, parsed, palette, _isDark, onClickItem, expor
|
|
|
7061
7141
|
const rotateFn = getRotateFn(cloudOptions.rotate);
|
|
7062
7142
|
const svg = d3Selection3.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
7063
7143
|
if (title) {
|
|
7064
|
-
svg.append("text").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
7144
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
7145
|
+
if (parsed.titleLineNumber) {
|
|
7146
|
+
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
7147
|
+
if (onClickItem) {
|
|
7148
|
+
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
7149
|
+
d3Selection3.select(this).attr("opacity", 0.7);
|
|
7150
|
+
}).on("mouseleave", function() {
|
|
7151
|
+
d3Selection3.select(this).attr("opacity", 1);
|
|
7152
|
+
});
|
|
7153
|
+
}
|
|
7154
|
+
}
|
|
7065
7155
|
}
|
|
7066
7156
|
const g = svg.append("g").attr(
|
|
7067
7157
|
"transform",
|
|
@@ -7111,7 +7201,10 @@ function renderWordCloudAsync(container, parsed, palette, _isDark, exportDims) {
|
|
|
7111
7201
|
const rotateFn = getRotateFn(cloudOptions.rotate);
|
|
7112
7202
|
const svg = d3Selection3.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
7113
7203
|
if (title) {
|
|
7114
|
-
svg.append("text").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
7204
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
7205
|
+
if (parsed.titleLineNumber) {
|
|
7206
|
+
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
7207
|
+
}
|
|
7115
7208
|
}
|
|
7116
7209
|
const g = svg.append("g").attr(
|
|
7117
7210
|
"transform",
|
|
@@ -7321,7 +7414,17 @@ function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims)
|
|
|
7321
7414
|
const svg = d3Selection3.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
7322
7415
|
const tooltip = createTooltip(container, palette, isDark);
|
|
7323
7416
|
if (title) {
|
|
7324
|
-
svg.append("text").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
7417
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
7418
|
+
if (parsed.titleLineNumber) {
|
|
7419
|
+
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
7420
|
+
if (onClickItem) {
|
|
7421
|
+
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
7422
|
+
d3Selection3.select(this).attr("opacity", 0.7);
|
|
7423
|
+
}).on("mouseleave", function() {
|
|
7424
|
+
d3Selection3.select(this).attr("opacity", 1);
|
|
7425
|
+
});
|
|
7426
|
+
}
|
|
7427
|
+
}
|
|
7325
7428
|
}
|
|
7326
7429
|
const defs = svg.append("defs");
|
|
7327
7430
|
const pad = 20;
|
|
@@ -7499,10 +7602,13 @@ function renderQuadrant(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
7499
7602
|
const svg = d3Selection3.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
7500
7603
|
const tooltip = createTooltip(container, palette, isDark);
|
|
7501
7604
|
if (title) {
|
|
7502
|
-
const titleText = svg.append("text").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style(
|
|
7605
|
+
const titleText = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style(
|
|
7503
7606
|
"cursor",
|
|
7504
7607
|
onClickItem && quadrantTitleLineNumber ? "pointer" : "default"
|
|
7505
7608
|
).text(title);
|
|
7609
|
+
if (quadrantTitleLineNumber) {
|
|
7610
|
+
titleText.attr("data-line-number", quadrantTitleLineNumber);
|
|
7611
|
+
}
|
|
7506
7612
|
if (onClickItem && quadrantTitleLineNumber) {
|
|
7507
7613
|
titleText.on("click", () => onClickItem(quadrantTitleLineNumber)).on("mouseenter", function() {
|
|
7508
7614
|
d3Selection3.select(this).attr("opacity", 0.7);
|