How to change the background color only for the part of the text in a mermaid node - mermaid

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```

Related

How to style a Mermaid subgraph's title?

How to style the title in a Mermaid subgraph? I would like to make the font larger and add some blank space between the title and the first node beneath it.
I tried adding some <br/>'s after the title but that pushed the title above the boundary of the subgraph.
graph TB
subgraph someID[Some Title]
direction TB
....
end
Styling a subgraph title seem to work like this:
graph TB
subgraph ED[Every Day]
A <--> B
end
style ED color:#f66
Caveat: I'm using Microsoft Github's in-browser Mermaid markdown preview and I'm not sure to what degree their implementation is conformant.
If you are looking for styling that do not include coloring, you may try something like this:
someID:::someClass
subgraph someID[Some Title]
someItem(The subgraph title has some style)
end
classdef someClass padding-left:5em;
Reference: Mermaid classes
Unfortunately, there is no possibility to style the title at the moment (see this pull request).
Note that given how subgraph SVG tags are built up, there is no (current) way to style the title text.

How to Create different kinds of grid lines using D3 in the same graph

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")

How can I apply a Top-to-Bottom layout on a Visio flowchart?

I understand that I can use the following code to layout shapes and links in Visio:
VISIO.ActivePage.PageSheet.Layout()
This will lay it out in the standard arrangement. I want it to layout such that it is in top-to-bottom arrangement (Where the flowchart would start at the bottom and go down). Any idea how?
Try this:
Visio.ActiveWindow.Page.PageSheet.CellsSRC(visSectionObject, visRowPageLayout, visPLOPlaceStyle).FormulaForceU = "1"
Visio.ActiveWindow.Page.Layout

d3js: How to remove nodes on exit properly?

I'm having a problem updating nodes in my force layout. I have used some help from another stackoverflow post for updating nodes. This worked out fine until I realized that everything(circle svg, lines, text, etc) were under their own "g" tag.
So that means that I cannot manipulate any of the text like I did before. If you compare this with this you can see that in the first fiddle, I can't increase the text size based on the click. d3.select(this).select("text") does not work since the "g" tags do not include a circle and a text together.
So I need to be able to manipulate the text in correspondence to the node. The second fiddle handles that but it has a problem updating the nodes. If you hit the update button, it updates all the nodes but it does not remove existing nodes. For the first fiddle, update works fine but i can't manipulate the text like I mentioned earlier. So for a solution, I need to either find a way to manipulate the text in the first fiddle, or for the second fiddle, I need to somehow have it properly update all the nodes on exit(). I would say the second fiddle would be more natural to work with since the nodes are set out in a structured layout. i.e, each circle and it's corresponding text are in "g" tags just like what you would group in divs.

Attach label to edge in graphviz when many labels are available

Consider the following edge in graphviz
a -> b [weight=5, foo="Ding", bar="Dong", label="something"];
Now by default, something is printed on edge when I convert this file to graph image using dot command. How can I change it to Dong without replacing bar with label?
Not possible unless you post-process.
E.g., you could output an svg file, add the foo and bar variables to a the edge href attribute, and then replace the label text automatically with, for example, javascript.

Resources