Commit a515806
Customize color for a link (#79)
* Customizable color for individual links
When adding links to a dataset now, we can add optionally include a 'color'
property. If it's set, said color will override the default color
defined in the configuration object.
In order for this to work, the 'buildLinkProps' is now receiving a 'link' object, which could contain any additional data aside from the source and target nodes. In this case, we'll be only considering a 'color' property that will be taken into account when setting the stroke color of the line to draw.
The former 'source' and 'target' parameters that used to be stand-alone parameters in the function, are now data contained inside of the
new 'link' object.
* Add tests for custom link feature
Added some new tests in the 'graph.helper.test' suite to check whether
the customization of the color for a certain link is working correctly.
We will be checking whether the stroke color matches the expected one in
both scenarios: when a custom color is set and when no color has been
passed along the link data.1 parent f4405a6 commit a515806
File tree
3 files changed
+55
-16
lines changed- src/components/graph
- test/component/graph
3 files changed
+55
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
| 179 | + | |
181 | 180 | | |
182 | 181 | | |
183 | 182 | | |
| |||
188 | 187 | | |
189 | 188 | | |
190 | 189 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
202 | 193 | | |
203 | 194 | | |
204 | 195 | | |
| |||
230 | 221 | | |
231 | 222 | | |
232 | 223 | | |
233 | | - | |
| 224 | + | |
234 | 225 | | |
235 | 226 | | |
236 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
23 | 72 | | |
24 | 73 | | |
25 | 74 | | |
| |||
0 commit comments