Skip to content

Commit 4bedd14

Browse files
committed
Dox & api minor tweaks
1 parent 582125a commit 4bedd14

File tree

12 files changed

+28
-126
lines changed

12 files changed

+28
-126
lines changed

src/components/MinimapXYFrame.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ class MinimapXYFrame extends React.Component {
3838
canvasLines,
3939
canvasPoints,
4040
canvasSummaries,
41-
minimap
41+
minimap,
42+
axes,
43+
margin
4244
} = this.props
4345
const miniDefaults = {
44-
title: "",
4546
position: [0, 0],
4647
size: [size[0], size[1] * 0.25],
4748
xAccessor: xAccessor,
@@ -67,7 +68,9 @@ class MinimapXYFrame extends React.Component {
6768
summaryRenderMode,
6869
canvasLines,
6970
canvasPoints,
70-
canvasSummaries
71+
canvasSummaries,
72+
axes,
73+
margin
7174
}
7275

7376
const combinedOptions = { ...miniDefaults, ...minimap }

src/components/constants/frame_props.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ export const networkframeproptypes = {
357357
nodeStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
358358
edgeStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
359359
customNodeIcon: PropTypes.func,
360-
zoomToFit: PropTypes.bool,
361360
edgeType: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
362361
filterRenderedNodes: PropTypes.func
363362
}

src/components/svg/frameFunctions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ type ORFrameAxisGeneratorTypes = {
8181
rScaleType: Function,
8282
pieceType: Object,
8383
rExtent: Array<number>,
84-
data: Array<Object>
84+
data: Array<Object>,
85+
maxColumnValues?: number
8586
}
8687

8788
function roundToTenth(number: number) {

src/docs/components/DonutChartRaw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const data2 = [15, 8, 5, 10]
88

99
export default state => {
1010
const donutSettings = {
11-
size: [400, 400],
11+
size: [600, 400],
1212
data: state.changeData ? data2 : data,
1313
projection: "radial",
1414
style: (d, i) => ({

src/docs/components/GenericChartsRaw.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,5 @@ export const genericNetworkChart = (
6464
})}
6565
edgeType={edgeType}
6666
nodeSizeAccessor={d => d.degree + 2}
67-
zoomToFit={true}
6867
/>
6968
)

src/docs/components/NetworkFrameDocs.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,6 @@ export default class NetworkFrameDocs extends React.Component {
420420
${
421421
this.state.annotations === "on" ? "annotations={annotations}" : ""
422422
}
423-
zoomToFit={true}
424423
nodeLabels={true}
425424
hoverAnnotation={true}
426425
annotationSettings={{

src/docs/components/Networks.js

Lines changed: 1 addition & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import React from "react"
22
import DocumentComponent from "../layout/DocumentComponent"
3-
import {
4-
basic,
5-
withCustomSimulation,
6-
bubbleChart,
7-
multiFoci,
8-
changeSimulationMode
9-
} from "./NetworksRaw"
3+
import { bubbleChart } from "./NetworksRaw"
104

115
const components = []
126
// Add your component proptype data here
@@ -33,47 +27,6 @@ export default class Networks extends React.Component {
3327

3428
render() {
3529
const examples = []
36-
examples.push({
37-
name: "Basic",
38-
demo: basic,
39-
source: `<NetworkFrame
40-
edges={data}
41-
networkType={{
42-
type: "force",
43-
iterations: 1000,
44-
forceManyBody: -250,
45-
distanceMax: 500,
46-
edgeStrength: 2
47-
}}
48-
nodeSizeAccessor={2}
49-
edgeStyle={{ stroke: "darkred" }}
50-
nodeIDAccessor="name"
51-
/>`
52-
})
53-
54-
examples.push({
55-
name: "Custom Simulation",
56-
demo: withCustomSimulation,
57-
source: `const customSimulation = forceSimulation().force(
58-
"charge",
59-
forceManyBody()
60-
.distanceMax(500)
61-
.strength(-100)
62-
)
63-
64-
<NetworkFrame
65-
edges={data}
66-
networkType={{
67-
type: "force",
68-
iterations: 500,
69-
simulation: customSimulation,
70-
edgeStrength: 2
71-
}}
72-
nodeSizeAccessor={2}
73-
edgeStyle={{ stroke: "darkred" }}
74-
nodeIDAccessor="name"
75-
/>`
76-
})
7730

7831
examples.push({
7932
name: "Bubble Chart",
@@ -97,48 +50,6 @@ export default class Networks extends React.Component {
9750
/>`
9851
})
9952

100-
examples.push({
101-
name: "Multi Foci Chart",
102-
demo: multiFoci,
103-
source: `const multiFociSimulation = forceSimulation()
104-
.force("collide", forceCollide().radius(d => d.r))
105-
.force("x", forceX(d => d.fociX))
106-
.force("y", forceY(d => d.fociY))
107-
108-
<NetworkFrame
109-
nodes={multiFociNodes}
110-
networkType={{
111-
type: "force",
112-
iterations: 300,
113-
simulation: multiFociSimulation,
114-
zoom: false
115-
}}
116-
nodeSizeAccessor={d => d.r}
117-
nodeStyle={d => ({ stroke: "darkred", fill: d.color })}
118-
nodeIDAccessor="name"
119-
/>`
120-
})
121-
122-
examples.push({
123-
name: "Change Modes",
124-
demo: changeSimulationMode(this.state.mode, this.changeMode),
125-
source: `<NetworkFrame
126-
nodes={combinedFociNodes}
127-
networkType={{
128-
type: "force",
129-
iterations: 500,
130-
simulation:
131-
mode === "combined"
132-
? bubbleSimulation
133-
: multiFociSimulation,
134-
zoom: false
135-
}}
136-
nodeSizeAccessor={d => d.r}
137-
nodeStyle={d => ({ stroke: "darkred", fill: d.color })}
138-
nodeIDAccessor="name"
139-
/>`
140-
})
141-
14253
return (
14354
<DocumentComponent
14455
name="Networks"

src/docs/components/NetworksRaw.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const multiFociSimulationForCombined = forceSimulation()
6060

6161
const multiFociNodes = [...Array(500)].map((d, i) => ({
6262
name: `Node ${i}`,
63-
r: Math.random() * 5 + 5 - i % 4,
63+
r: Math.random() * 5 + 5 - (i % 4),
6464
fociX: (i % 2) * 200 + 200,
6565
fociY: Math.floor((i % 4) / 2) * 200 + 200,
6666
color: colors[i % 4]
@@ -100,11 +100,12 @@ export const withCustomSimulation = (
100100
export const bubbleChart = (
101101
<NetworkFrame
102102
nodes={bunchaNodes}
103+
size={[400, 900]}
103104
networkType={{
104105
type: "force",
105106
iterations: 400,
106107
simulation: bubbleSimulation,
107-
zoom: false
108+
zoom: true
108109
}}
109110
nodeSizeAccessor={d => d.r}
110111
nodeStyle={{ stroke: "darkred" }}

src/docs/components/Process.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,7 @@ const networkPossibilities = [
8383
networkType: { type: "wordcloud", textAccessor: d => d.id },
8484
nodeSizeAccessor: d => nodeScale(d.input + d.output),
8585
edges: undefined
86-
},
87-
{
88-
networkType: "force",
89-
zoomToFit: true,
90-
nodeSizeAccessor: d => nodeScale(d.input + d.output)
91-
}
92-
]
86+
}]
9387

9488
const formatter = d => (d > 1000 ? `${parseInt(d / 1000)}k` : d)
9589

src/docs/components/ProcessViz.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ const processNodes = [
7171
projection: true,
7272
oPadding: true,
7373
dynamicColumnWidth: true,
74-
pixelColumnWidth: true,
75-
zoomToFit: true
74+
pixelColumnWidth: true
7675
}
7776
},
7877
{
@@ -259,20 +258,20 @@ export default class ProcessViz extends React.Component {
259258
{k === "nodes" || k === "edges"
260259
? "these data tend to be circular"
261260
: typeof frameSettings[k] === "function"
262-
? `${frameSettings[k]}`
263-
: JSON.stringify(
264-
frameSettings[k],
265-
(key, value) => {
266-
if (typeof value === "function") {
267-
return `${value}`
268-
}
261+
? `${frameSettings[k]}`
262+
: JSON.stringify(
263+
frameSettings[k],
264+
(key, value) => {
265+
if (typeof value === "function") {
266+
return `${value}`
267+
}
269268

270-
return key === "nodes" || key === "edges"
271-
? ""
272-
: value
273-
},
274-
" "
275-
)}
269+
return key === "nodes" || key === "edges"
270+
? ""
271+
: value
272+
},
273+
" "
274+
)}
276275
</PrismCode>
277276
</pre>
278277
</div>

0 commit comments

Comments
 (0)