I'm wondering if it is possible to split a node into two different colours.
I'm using graphviz's dot (http://www.graphviz.org/).
Perhaps a verticle, or diagonal line could split the node into two colours. I want to do this because I have many nodes which belong to two different categories (colours) with some nodes belonging to both.
Many thanks,
James
Gradient functionality was only added to Graphviz on January 26, 2012; until the new 2.30.0 stable version of Graphviz is released, you'll need to download Graphviz development version 2.29.20120127.0545 or newer.
In addition, gradients seem to only be implemented for the Cairo/Pango renderer so far; in my tests, the Quartz (Mac) and GD renderers fall back to using just the first color. In particular, this means if you're on a Mac and are using the Graphviz.app GUI viewer, you won't see gradients there (yet).
digraph G {
Gradient [style="filled", fillcolor="orange:yellow"]
}
I don't think there is an out-of-the-box solution to have 2 background colors.
The best solution would be to use gradient fills (fillcolor="orange:yellow") - but though this is in the documentation, I wasn't able to make it work on my box.
You could use HTML-like labels as a workaround. You may need to split the label to have it centered, depending on your needs:
a[shape="none", label=<
<table cellpadding="0" cellborder="0" cellspacing="0" border="0">
<tr>
<td bgcolor="orange">abc</td>
<td bgcolor="yellow">def</td>
</tr>
</table>
>]
It is possible, if you use the image attribute of a label and provide a suitable background image:
digraph G {
i1 [shape=none, image="range.png", label=""];
i2 [shape=none, image="range.png", label="Image w label", imagescale=true];
i1 -> i2;
}
This gives the following output:
using the range.png file
Related
I'm making a flow diagram where I need part of the text or its background to be of a different style. I tried to add style to the inside text, but it didn't work.
graph TD
B --> C{Let <span style="background-color:#ddd">me</span> think}
Is it possible? Any recommendations?
The workaround that I'm thinking of is to have two blocks of different styles/backgrounds and removing the borderline according to this https://mermaid.js.org/syntax/flowchart.html#styling-a-node
graph TB
subgraph block[" "]
C[text1]
D
style C fill:blue,stroke-width:0px
style D fill:yellow,stroke-width:0px
end```
I am using D3 to generate the graph in an angular 5 project. I have a requirement to generate the graph as shown in required attachment. It has both solid and dashed grid lines in the same graph. I am not sure how I can achieve it.
Can anyone please help me to fix it ? Please find the actual and required graphs
Image 1 - Actual
Image 2 - Required
perhaps you can look at this example to add Minor ticks and Major ticks.
https://bl.ocks.org/erikvullings/41be28677574fd484b43e91413a7e45d
you can use the attribute stroke-dasharray to create dashed lines. It depends on the structure of your svg, but you can select the lines and add this attribute.
example:
d3.selectAll("g.tick line").attr("stroke-dasharray", "5 5")
Without using HTML, what is a straightforward way to resize external images used in a GraphViz document?
For example, with the following:
somenode [size=1 image="littleperson.png", label=""];
How can the image be made smaller? [Preferably without HTML, using HTML if it's most straightforward/unavoidable.]
I'm not having much luck with HTML:
somenode [label=<<IMG SRC="littleperson.png" />>];
Throws back an error.
You can make the external images smaller several ways.
Without HTML, Using imagescale attribute and / or fixedsize attribute, along with the width and height attributes of the node.
somenode [width=50 height=50 fixedsize=true image="littleperson.png", label=""];
With HTML (img HTML tag takes the scale attribute which has same parameters as imagescale), attributes for fixedsize and height and width are of the td which contains the image tag.
somenode [label=< <table><tr><td fixedsize="true" width="50" height="50"><img src="littleperson.png" /></td></tr></table> >];
Resize the image in a external program and load it
somenode [image="littleperson_resized.png", label=""];
Further documentation / References
How to display an image in a Node
How to set width and height of image displayed in a Node
Graphviz Shapes Documentation
Graphviz Attribute Documentation
I have two div on html page having id container1 and container2 i have created svg for each div and each svg contain circle, Now i want to connect two circle
Is it possible to connect two circle from two svg file on same page (cx,cy of both circle should genrate automatically)
My code snnipet..
Html
<div id="container1 " style="width:900px;height:800px;border:solid;"></div>
<div id="container2 " style="width:900px;height:100px;border:solid; margin-top: 25px;"></div>
created svg for container1 ,container2 using below code
var svg = d3.select("#"+id).append("svg")
.attr("width", $("#"+id).css("width"))
.attr("height",$("#"+id).css("height"));
and draw circle for each container using force layout
Now I want to connect these two circle using line
How is it possible ???
For your general question "how is it possible?", here is a general approach to get you started:
Super-impose a third, mostly transparent SVG over the whole page using absolute positioning. Draw the line inside this SVG.
Use .getScreenCTM() (get screen cumulative transformation matrix) to calculate the position of each circle on the page.
Use the same function to figure out the transformation from the screen to your overlay SVG, and multiply one screen CTM by the inverse of the other to get the net transformation so you can figure the start and end coordinates of your lines from the coordinates of your circles.
Add a listener to the web page as a whole for any re-layout events, and re-do the calculations above as necessary.
If all of that sounds too confusing, you might want to come up with an alternate web page design that puts all the graphics in one SVG. Or one which allows for a different way to indicate that elements are connected (same colour, or hover over one causes highlight on the other).
P.S. You might be able to use .getTransformToElement() to replace steps 2 and 3, but you'll want to test that out thoroughly. I've never tried using it to find the transformation between elements in different SVGs on the same web page.
I am having a frustrating issue with Google Chrome for the first time.
I have a site that has started to get pretty heavy with graphics and today I started seeing blue sections over certain parts of my page. See the graphic below.
I have tried to back out any changes and remove some graphics to lighten the page up but I am still seeing blue bars and sometimes the blue fills the full background.
I'm using transparent PNGs heavily and am creating a side scroll scene but haven't had any problems until now. Why does Chrome place these blue bars on my page? Thanks for any help you could offer.
REMOVE BACKGROUND COLOR FROM YOUR HTML.
eg: <table style="background-color: rgb(208, 208, 208);" align="center" border="0" cellpadding="0" cellspacing="0" width="960">
To: <table style="background-color: transparent;" align="center" border="0" cellpadding="0" cellspacing="0" width="960">
And Declare Graphics image ONLY!! Not BACKGROUND COLOR
Hope this helps.