Skip to content

Commit a34fe43

Browse files
committed
Update website
1 parent b15617b commit a34fe43

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1118
-1915
lines changed

docs/404.html

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE-text.html

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE.html

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/Examples.html

+17-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/Examples_files/D3-7.8.5/GCVieweRwidget.js

+38-70
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ HTMLWidgets.widget({
33
type: 'output',
44

55
factory: function (el, width, height) {
6-
var data,
6+
var
7+
graphContainer,
8+
style,
9+
data,
710
series,
811
titleOptions,
912
legendOptions;
@@ -14,6 +17,18 @@ HTMLWidgets.widget({
1417
// Clear out the container if it has anything
1518
d3.select(el).selectAll('*').remove();
1619

20+
el.style["height"] = "100%"
21+
22+
// Apply styles
23+
if (style && typeof style === 'object' && Object.keys(style).length > 0) {
24+
// Apply styles from the style object
25+
for (var key in style) {
26+
if (style.hasOwnProperty(key)) {
27+
el.style[key] = style[key];
28+
}
29+
}
30+
}
31+
1732
// Add Title
1833

1934
if (titleOptions !== null && titleOptions?.height !== null && titleOptions?.show) {
@@ -23,26 +38,21 @@ HTMLWidgets.widget({
2338
.attr("id", `GCvieweR-title-container-${widgetId}`)
2439
.classed("GCVieweR-container", true);
2540

26-
var titleHeight = computeSize(titleOptions?.height, height)
27-
var titleWidth = computeSize(titleOptions?.width, width)
41+
42+
titleOptions.width = el.clientWidth
43+
titleOptions.height = computeSize(titleOptions.height, el.clientHeight)
2844

2945
var title = createContainer(
3046
`#GCvieweR-title-container-${widgetId}`,
3147
"svg-container",
3248
"titleOptions",
33-
{
34-
width: titleWidth,
35-
height: titleHeight,
36-
backgroundColor: titleOptions?.backgroundColor ?? "#0000",
37-
margin: titleOptions?.margin
38-
})
49+
titleOptions)
3950
.title(titleOptions?.title, titleOptions?.subtitle, titleOptions?.show ?? false, titleOptions)
40-
4151
}
4252

4353
// Add legend
4454

45-
var legendHeight = (legendOptions?.show === false) ? 0 : computeSize(legendOptions?.height, height);
55+
var legendHeight = (legendOptions?.show === false) ? 0 : computeSize(legendOptions?.height, el.clientHeight);
4656

4757
if (legendOptions?.group !== null && legendOptions?.show) {
4858

@@ -51,15 +61,13 @@ HTMLWidgets.widget({
5161
.attr("id", `GCvieweR-legend-container-${widgetId}`)
5262
.classed("GCVieweR-container", true);
5363

64+
legendOptions.width = width
65+
legendOptions.height = computeSize(legendOptions.height, el.clientHeight)
66+
5467
var legendContainer = createContainer(`#GCvieweR-legend-container-${widgetId}`,
5568
"svg-container",
5669
"legendOptions",
57-
{
58-
width: computeSize(legendOptions?.width, width),
59-
height: legendHeight,
60-
backgroundColor: legendOptions?.backgroundColor ?? "#0000",
61-
margin: legendOptions.margin
62-
})
70+
legendOptions)
6371
.legendData(data)
6472
.legend(legendOptions?.group ?? false, legendOptions?.show ?? false, el.id, legendOptions);
6573

@@ -72,16 +80,16 @@ HTMLWidgets.widget({
7280
var graph = d3.select(el)
7381
.append("div")
7482
.attr("id", `GCvieweR-graph-container-${widgetId}`)
83+
.style("flex-direction", graphContainer["direction"])
7584
.classed("GCVieweR-container", true);
7685

7786
// Add Clusters
78-
7987
var clusters = Object.keys(series);
8088

8189
clusters.forEach(function (clusterKey) {
8290

8391
var cluster = series[clusterKey],
84-
clusterStyle = cluster.style,
92+
clusterOptions = cluster.options,
8593
clusterData = HTMLWidgets.dataframeToD3(series[clusterKey].data),
8694
scaleOptions = cluster.scale,
8795
clusterTitleOptions = cluster.clusterTitle,
@@ -94,26 +102,15 @@ HTMLWidgets.widget({
94102
scaleBarOptions = cluster.scaleBar;
95103
tooltipOptions = cluster.tooltip;
96104

97-
// Calculate height and width
98-
var clusterHeight = computeSize(series[clusterKey]["grid"].height, el.clientHeight);
99-
clusterHeight -= titleHeight ? (titleHeight / clusters.length) : 0;
100-
clusterHeight -= legendHeight ? (legendHeight / clusters.length) : 0;
101-
var clusterWidth = computeSize(series[clusterKey]["grid"].width, width);
102-
var clusterMargins = series[clusterKey]["grid"].margin;
103-
104-
var clusterOptions = {
105-
width: clusterWidth,
106-
height: clusterHeight,
107-
style: clusterStyle,
108-
margin: {
109-
top: computeSize(clusterMargins?.top ?? 0, height),
110-
right: computeSize(clusterMargins?.right ?? 50, width),
111-
bottom: computeSize(clusterMargins?.bottom ?? 0, height),
112-
left: computeSize(clusterMargins?.left ?? 50, width)
113-
}
114-
};
115105

116-
var cluster = createContainer(`#GCvieweR-graph-container-${widgetId}`, "svg-container", 'clusterOptions', clusterOptions)
106+
107+
var clonedClusterOptions = JSON.parse(JSON.stringify(clusterOptions));
108+
clonedClusterOptions.height = computeSize(clonedClusterOptions.height, el.clientHeight);
109+
clonedClusterOptions.height -= titleOptions.height ? (titleOptions.height / clusters.length) : 0;
110+
clonedClusterOptions.height -= legendHeight ? (legendHeight / clusters.length) : 0;
111+
clonedClusterOptions.width = computeSize(clonedClusterOptions.width, el.clientWidth);
112+
113+
var cluster = createContainer(`#GCvieweR-graph-container-${widgetId}`, "svg-container", 'clusterOptions', clonedClusterOptions)
117114
.theme("preset")
118115
.title(clusterTitleOptions?.title, clusterTitleOptions?.subtitle, clusterTitleOptions?.show ?? false, clusterTitleOptions)
119116
.footer(footerOptions?.title, footerOptions?.subtitle, footerOptions?.show ?? false, footerOptions)
@@ -141,47 +138,18 @@ HTMLWidgets.widget({
141138
var legendContainer = createContainer(`#GCvieweR-legend-container-${widgetId}`,
142139
"svg-container",
143140
"legendOptions",
144-
{
145-
width: computeSize(legendOptions?.width, width),
146-
height: legendHeight,
147-
backgroundColor: legendOptions?.backgroundColor ?? "#0000",
148-
margin: legendOptions.margin
149-
})
141+
legendOptions)
150142
.legendData(data)
151143
.legend(legendOptions?.group ?? false, legendOptions?.show ?? false, el.id, legendOptions);
152144

153-
154-
155-
}
156-
157-
// Bottom Title
158-
if (titleOptions?.position == "bottom" && titleOptions !== null && titleOptions?.height !== null && titleOptions?.show) {
159-
160-
d3.select(`#GCvieweR-title-container-${widgetId}`).remove();
161-
162-
var titleContainer = d3.select(el)
163-
.append("div")
164-
.attr("id", `GCvieweR-title-container-${widgetId}`)
165-
.classed("GCVieweR-container", true);
166-
167-
var title = createContainer(
168-
`#GCvieweR-title-container-${widgetId}`,
169-
"svg-container",
170-
"titleOptions",
171-
{
172-
width: width,
173-
height: titleHeight,
174-
backgroundColor: titleOptions?.backgroundColor ?? "#0000",
175-
margin: titleOptions?.margin
176-
})
177-
.title(titleOptions?.title, titleOptions?.subtitle, titleOptions?.show ?? false, titleOptions)
178-
179145
}
180146

181147
};
182148

183149
return {
184150
renderValue: function (input) {
151+
graphContainer = input.graphContainer;
152+
style = input.style;
185153
data = HTMLWidgets.dataframeToD3(input.data);
186154
series = input.series;
187155
titleOptions = input.title;

docs/articles/Examples_files/D3-7.8.5/lib/GCVieweR-0.1.0/GCVieweR.js

+7-63
Original file line numberDiff line numberDiff line change
@@ -490,67 +490,6 @@ function parseAndStyleText(text, parentElement, fontOptions) {
490490
}
491491
}
492492

493-
// CLuster
494-
495-
/*
496-
497-
function clusterContainer(svg, margin, width, height) {
498-
this.svg = svg;
499-
this.margin = margin;
500-
this.width = width;
501-
this.height = height;
502-
}
503-
function createClusterContainer(targetElementId, options = {}) {
504-
505-
const defaultOptions = {
506-
id: "svg-container",
507-
margin: { top: 0, right: "50px", bottom: 0, left: "50px" },
508-
style: {
509-
backgroundColor: "#0000"
510-
},
511-
width: null,
512-
height: null
513-
};
514-
515-
// Merge default options and user-specified options
516-
const combinedOptions = mergeOptions.call(this, defaultOptions, 'clusterOptions', options);
517-
const { id, margin: originalMargin, style, width, height } = combinedOptions;
518-
519-
// Extract additional options that are not in defaultOptions
520-
const additionalOptionsStyle = extractAdditionalOptions(style, defaultOptions.style);
521-
522-
// Compute margins without modifying the original margin object
523-
const computedMargin = {
524-
top: computeSize(originalMargin.top, height),
525-
right: computeSize(originalMargin.right, width),
526-
bottom: computeSize(originalMargin.bottom, height),
527-
left: computeSize(originalMargin.left, width)
528-
};
529-
530-
var svg = d3.select(targetElementId)
531-
.append("svg")
532-
.attr("id", getUniqueId(id))
533-
.attr("width", width || "100%")
534-
.attr("height", height || "100%")
535-
.attr("preserveAspectRatio", "xMinYMin meet")
536-
.attr("viewBox", `0 0 ${width || computedWidth} ${height || computedHeight}`)
537-
.classed("GCVieweR-svg-content", true)
538-
.style("box-sizing", "border-box")
539-
.style("background-color", style.backgroundColor)
540-
.each(function () {
541-
const currentElement = d3.select(this);
542-
setStyleFromOptions(currentElement, additionalOptionsStyle);
543-
});
544-
545-
// Apply styles from the combined options
546-
Object.entries(style).forEach(([key, value]) => {
547-
svg.style(key, value);
548-
});
549-
550-
return new clusterContainer(svg, computedMargin, width, height);
551-
}
552-
*/
553-
554493
function container(svg, margin, width, height) {
555494
this.svg = svg;
556495
this.margin = margin;
@@ -562,7 +501,7 @@ function createClusterContainer(targetElementId, options = {}) {
562501

563502
const defaultOptions = {
564503
id: id || "svg-container",
565-
margin: { top: 0, right: "50px", bottom: 0, left: "50px" },
504+
margin: { top: 5, right: 50, bottom: 5, left: 50 },
566505
style: {
567506
backgroundColor: "#0000"
568507
},
@@ -1096,6 +1035,7 @@ container.prototype.clusterLabel = function (title, show = true, options = {}) {
10961035
};
10971036

10981037
container.prototype.sequence = function (show = true, options = {}) {
1038+
10991039
if (!show) {
11001040
return this;
11011041
}
@@ -2069,10 +2009,14 @@ container.prototype.legend = function (group, show = true, parentId = null, opti
20692009
});
20702010

20712011
if (adjustHeight && this.height === 0) {
2072-
var contentHeight = currentY + legendSize + legendPadding;
2012+
var padding = 20;
2013+
var contentHeight = currentY + legendSize + legendPadding + padding;
2014+
20732015
svgLegend.attr("height", contentHeight);
20742016
var viewBoxWidth = parentWidth;
20752017
svgLegend.attr("viewBox", `0 0 ${viewBoxWidth} ${contentHeight}`);
2018+
g.attr("transform", `translate(${this.margin.left}, ${this.margin.top + padding / 2})`);
2019+
20762020
}
20772021

20782022
return this;

0 commit comments

Comments
 (0)