I am trying to create a graph using graphviz in my Sphinx documentation.
I managed to include a href in the graph to link an external web page (good example here https://jhermann.github.io/blog/python/documentation/2020/03/25/sphinx_ext_graphviz.html).
I would now like do the same but referencing another page of my documentation (using something like :ref:`another page of my documentation` instead of the href). Expected result is: you click on a node of the graph and it opens the corresponding documentation page/ section.
Is this possible? Any workarounds for this?
I would assume that any value that you put in an href attribute that works in HTML would also work in graphviz. Try adding a relative path for its value, for example:
.. graphviz::
:name: name
digraph "my-digraph" {
my [label="my-label",
shape="component",
href="relative/path/to/file.html"
target="_blank"];
}
Related
Is it possible to create an intra-document link with sphinx, such that the displayed text is independent of the link and destination?
Currently, I make intra-document links like so:
.. _Label_For_Section:
===============
Name Of Section
===============
The link :ref:`Label_For_Section` is rendered as "Name Of Section".
The link Label_For_Section_ is rendered as "Label_For_Section".
What I want is a way to have a link, where the destination text, link label, and displayed link text can all be different strings. Eg a link to a section called "A" with a label .. _B: which is rendered as "C"
Note
I noticed that other kinds of links (eg external hyperlinks) are similarly constrained, and I figure the solutions may look similar, however I am looking specifically for a solution for intra-document links.
See Cross-referencing arbitrary locations, specifically the ref role.
:ref:`Link title <label-name>`
I am trying to follow the advice laid out in this post's answer and comments: Hyperlinks in d3.js objects to add hyperlinks to circles in a d3.js bubble graph. Here's where I am trying to do this, and here's the original bl.ock I am trying to modify. As you can see all I've done is the following:
Replace <html> tag with: <html xmlns:xlink="http://www.w3.org/1999/xlink">
Insert this code right after creation of var node
node.append("svg:a").
attr("xlink:href", function(d){return "http://www.google.com";});
I am using Chrome and Firefox to test the page, and I don't see a hyperlink in either. Following some comments on the answer, I have tried:
Removing the html namespace declaration
Using node.append("a")
I don't see any results with any of these options, though I have been clearing my browser cache and using multiple computers to make sure I am seeing the fresh code. What am I doing wrong?
The <a> has no content so it has no click area. You need to make something a child of the <a> nodes.
I would like to modify the Collapsable Tree located at the following URL: http://bl.ocks.org/d/4339083/
I have tried copying the source code at think link to a text file and then I try to display it on my browser but I get an empty screen.
I changed the following code in the source code:
d3.json("/d/4063550/flare.json", function(error, flare) {
to
d3.json("http://bl.ocks.org/d/4063550/flare.json", function(error, flare) {
but that didn't work either.
I would like to modify the original HTML file so that I can put my own text on top of each node. I would also like to change the amount of nodes. How can I do this?
You are breaking the same orgin policy. You cannot do cross domain calls.
There is a technique called JSONP which is also supported by jQuery.
First, I've already tried showing a graph using a FileContentResult and the write method. But I can't use both since my requirement requires me to show a grid on 1 tab and a graph on the next tab. So I need to store the graph in a ViewBag and render it to a view, but I'm unable to do that. Is there anyway around?
Note: I'm using the Chart object from System.Web.Helpers namespace.
Thanks,
czetsuya
You can render chart as partial view.
you can use System.Web.Helpers namespace here an example:
http://msdn.microsoft.com/en-us/library/system.web.helpers.chart(v=vs.99).aspx
A chart is just an image. Link to it.
<img src="#Html.Action("ImageAction")" alt="Chart" />
I found a solution (without executing the same query), I stored the image in a cache and later refer to it via a unique key. Unfortunately, I needed to issue another http request for it. See post here: http://czetsuya-tech.blogspot.com/2012/02/how-to-render-chart-object-in-view-in.html
I want to link to a documentation of a file in RDoc. but the only way I could do is with the following markup:
configuration.rb[link:files/configuration_rb.html]
I would like to do it in a better way, something like this:
<file>configuration.rb</file>
Is there any existing markup rule to do this?
EDIT: of course I've tried without any markup like this configuration.rb but it shows the filename without the link :(
To display a link in rdoc
{Link label}[url ]
Sample
{Killer question}[http://http://stackoverflow.com/questions/2230954/is-there-any-way-to-easily-link-a-file-in-rdoc]
will create a link of the this question
Auto hyperlinked: MyClass
my_class.rb def my_method; end;
#my_method http:, mailto:, ftp:, www. link: (to local filesystem relative to
--op) (urls to images are rendered as inline image tags) label[url] (uses
label as hyperlink text) {multi word
label}[url] (uses label as hyperlink
text)
Ruby:
ClassNames, source_files.rb and
either
method_name_having_an_underscore or
#methodnamewithhash are hyperlinked to their documentation.
It sounds like you're looking for that second one, but I've never used it before so I can't give you a fully useful example.
Try not to use markup at all.
Look at RDoc's own documentation, they have similar links in the "Roadmap" paragraph. They markup is here.
Magic!