-
naruka17August 9, 2016 at 10:44 am #6364
Hi,
I am working on weighted tree chart and having one requirement.
I want to have same color for node and link if nodes has same name. for example.if node0 has 4 child’s n1, n2, n3 and node0 then node0 should has same color as parent node0.
base- node0(red), > n1, n2, n3, node0(should be red) >
node1(green),
node3(yellow)Thanks
ChetanvizulyAugust 9, 2016 at 1:01 pm #6370Hi Chetan,
Thank you for your detailed question.
The place you want to go to modify the color is in the
applyTheme()
function of thesrc/theme/weightedtree.js
file.It is here where you can set colors for nodes and links and apply any logic you would like. As a convenience, the theme precomputes all child colors based on the root level parent nodes – you can either use this value (
d.vz_link_color
), modify it, or ignore it.I hope that helps.
I will answer your other topic questions shortly.
– Tom
naruka17August 11, 2016 at 8:57 am #6378thank you.
I have implemented the changes but in different way.
I used one object, which stores distinct node name and color while creating levels. last i using it to change the colors.Thanks
Chetankuntal shahNovember 16, 2016 at 12:12 pm #6676Hi, i am trying to change the colors in the weighted tree visualization, but when i edit the colors in the src/theme/weightedtree.js nothing changes in the visualization
This is the block of code where i am changing the color codes. I have tried changing the codes in both teh Axiis and None skins and nothing changes in the final visual. I even played around and renamed Axiis to something random, and no impact happened. Please advise, thanks!
link_colors: [“#bd0026”, “#fecc5c”, “#fd8d3c”, “#f03b20”, “#B02D5D”,
“#9B2C67”, “#982B9A”, “#692DA7”, “#5725AA”, “#4823AF”,
“#d7b5d8”, “#dd1c77”, “#5A0C7A”, “#5A0C7A”],
link_stroke: function (d, i) {vizulyNovember 16, 2016 at 2:53 pm #6677Hello Kuntal,
You are in the correct place to edit the colors, and when I went to test it myself I thought you may have found a bug since changing that code wasn’t having an effect for me either.
BUT, probably like yourself, I forgot to uncomment out links to the source code scripts the main HTML file so I could see the changes. Once I did that, it works as expected.
Make sure you have these javascript references to the source files in your HTML test container file (you need to comment out the minified versions – this is discussed here under “Our first look” http://vizuly.io/docs-getting-started/)
<!-- debug source scripts: start --> <script src="src/namespace/namespace.js"></script> <script src="src/viz/_viz.js"></script> <script src="src/theme/_theme.js"></script> <script src="src/core/component.js"></script> <script src="src/core/data.js"></script> <script src="src/core/util.js"></script> <script src="src/core/color.js"></script> <script src="src/core/format.js"></script> <script src="src/svg/_svg.js"></script> <script src="src/svg/gradient.js"></script> <script src="src/svg/filter.js"></script> <script src="src/viz/weightedtree.js"></script> <script src="src/theme/weightedtree.js"></script> <!-- debug source scripts: end --> <!--script src="lib/vizuly_core.min.js"></script> <script src="lib/vizuly_weightedtree.min.js"></script-->
JerryDecember 21, 2016 at 12:09 pm #6833Hi Tom,
I edited
link_colors: [“#bd0026”, “#fecc5c”, “#fd8d3c”, “#f03b20”, “#B02D5D”,
“#9B2C67”, “#982B9A”, “#692DA7”, “#5725AA”, “#4823AF”,
“#d7b5d8”, “#dd1c77”, “#5A0C7A”, “#5A0C7A”],
link_stroke: function (d, i) {
in src/theme/weightedtree.js, it works.
Then I tried it in lib/vizuly_core.min.js, it does not work. Do you know why?vizulyDecember 21, 2016 at 12:44 pm #6835Hi Jerry,
The vizuly_core.min.js is a minified file from source code, you shouldn’t try to edit it directly.
If you want minified files then try using a minifier of your choice to include the needed source files.
Alternatively, you can include the modified source code AFTER you declare the vizuly_core.min.js files in the HTML header.
– Tom
JerryDecember 21, 2016 at 1:07 pm #6836Hi Tom
Thank you for your reply. I will try to minify the source file later.
I have two more questions.
1. How do you control the opacity of the color of nodes and licks?
2. How do you map the color to the first level nodes and links?Thank you
JerryvizulyDecember 21, 2016 at 1:10 pm #6837Hi Jerry,
All of those settings are within the theme/weightedtree.js file.
See the
prepColorData(), setLinkColor(), and applyTheme()
functions to make those changes.– Tom
-
|
You must be logged in to reply to this topic.