Skip to content

Commit 161531a

Browse files
committed
Changes some sizes in GraphRenderer/GraphTracer
1 parent d771dcb commit 161531a

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

src/components/DataStructures/Graph/GraphRenderer/GraphRenderer.module.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,12 @@
131131
.edge {
132132
.line {
133133
stroke: var(--graph-edge-line-stroke);
134-
stroke-width: 2.5;
134+
// For various trees we don't care much about edges so having them
135+
// thin is fine but for some graph algorithms in particular we
136+
// want to highlight edges and change their color to we want
137+
// reasonable thick edges; this is a compromise (maybe we could
138+
// add an interface to adjust it for different algorithms XXX)
139+
stroke-width: 7; // width of edges in graphs
135140
fill: none;
136141

137142
&.directed {
@@ -143,6 +148,9 @@
143148
fill: var(--graph-edge-line-weight-fill);
144149
alignment-baseline: baseline;
145150
text-anchor: middle;
151+
// font size for labels in nodes - should be linked to node radius
152+
// XXX but currently isn't. Another difficulty was node sizes
153+
// were adjusted depending on coordinate list - now deleted.
146154
// font-size: 15px;
147155
font-size: 35px;
148156
}

src/components/DataStructures/Graph/GraphRenderer/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ class GraphRenderer extends Renderer {
125125
}
126126

127127
/**
128-
* Add scales to the axis
128+
* Add scale tick marks to the axis
129129
*/
130130
computeScales(
131131
min,
132132
max,
133133
center,
134134
stepSize = 30,
135-
stepHeight = 5,
135+
stepHeight = 15, // size of scale mark tick on axes
136136
increment = 1
137137
) {
138138
const scales = [];
@@ -273,14 +273,14 @@ class GraphRenderer extends Renderer {
273273
const axisArrowX = this.computeArrows(
274274
'x',
275275
{ x: axisEndPoint, y: axisCenter.y },
276-
8,
277-
8
276+
18,
277+
18
278278
); // list containing fragments to form arrow on x
279279
const axisArrowY = this.computeArrows(
280280
'y',
281281
{ x: axisCenter.x, y: axisEndPoint },
282-
8,
283-
8
282+
18,
283+
18
284284
); // list containing fragments to form arrow on y
285285

286286
const labelPadding = 20;
@@ -383,7 +383,7 @@ class GraphRenderer extends Renderer {
383383
/>
384384
<text
385385
x={scale.x1}
386-
y={originCoords.y + 20}
386+
y={originCoords.y + 30}
387387
textAnchor="middle"
388388
className={styles.axisLabel}
389389
>
@@ -403,7 +403,7 @@ class GraphRenderer extends Renderer {
403403
className={styles.axis}
404404
/>
405405
<text
406-
x={originCoords.x - 15}
406+
x={originCoords.x - 25}
407407
y={scale.y1 + 6}
408408
textAnchor="middle"
409409
className={styles.axisLabel}

src/components/DataStructures/Graph/GraphTracer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,14 @@ class GraphTracer extends Tracer {
9393
if(maxCoord < (i + 1) * 10)
9494
{
9595
const radiusIncrease = (i - 1) * 6
96-
this.dimensions.nodeRadius = this.dimensions.defaultNodeRadius + radiusIncrease;
96+
// XXX makes graph nodes rather fat compared with tree nodes
97+
// with default values so I've deleted it for now
98+
// this.dimensions.nodeRadius = this.dimensions.defaultNodeRadius + radiusIncrease;
9799
return;
98100
}
99101
}
100102

103+
// XXX
101104
// SHOULD ALSO SET LABEL SIZE OF NODE HERE !!!
102105
// ALTERNATIVELY LABEL SIZE SHOULD BE CALCULATED ELSEWHERE DEPENDANT ON NODE RADIUS!!!
103106
}

0 commit comments

Comments
 (0)