- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在过去的 15 分钟里,我一直在谷歌上搜索,试图找到这个问题的答案。但我似乎无法弄清楚。
我的任务是为我在工作中开发的一些应用程序构建一些小流程图。他们不需要任何花哨的东西,因为他们将在 vizio 中将其转换为他们喜欢的格式。他们甚至说我们可以用纸笔来做。所以我想我会玩弄graphviz/dot。
他们有 6 种他们喜欢使用的预定义形状/颜色,所以我想我会使用它们。我已经在 dot 中构建了它们……但是如果我打算多次重复使用它们,我想找到一种方法将它们保存为一种模板。
那可能吗?
例如...这些是预定义的形状。
digraph G {
node [color="#4271C6"]
process [
shape=Mrecord,
style=filled, fillcolor="#E1F4FF",
label="{1. Process\l | Description}"];
subprocess [
shape=record,
style=filled, color="#FFFFFF", fillcolor="#A5A5A5",
label="| Sub-Process |"];
database [
shape=cylinder, color="#18589A",
label="Database"];
inputoutput [
shape=polygon,
style=filled, fontcolor=white,
fixedsize=true, skew=0.3, margin=0,
width=2, label="Input / Output"];
file [
shape=folder,
label="File"];
external [
shape=box3d,
label="External entity"];
}
最佳答案
不幸的是,没有办法定义宏或对象并重用——尤其是跨多个图形。但是,也有使用其他工具的方法。有些人使用 m4(宏语言)或 cpp(C 预处理器)两者都可以工作,但存在潜在的操作系统问题。 Python, awk, ... 也可以。
这是一个 gvpr 程序(gvpr 是 Graphviz 包的一部分),它也可以满足您的要求(我认为):
digraph pre{
a [_type=process label="{1. Process\l | Something}"]
b [_type=process label="{2. Process\l | Something else}"]
c [_type=subprocess label="do it"]
d [_type=database label="lots of data"]
e [_type=database label="a bit of data"]
f [_type=inputoutput label="inOut"]
g [_type=file label="nail file"]
h [_type=external label="outside"]
a->b->c->d->e->f->g->h
}
gvpr 程序:
BEG_G{
$G.newrank="true";
}
N{
$.color="#4271C6"; // default
}
N[_type=="process"]{
$.shape="Mrecord";
$.style="filled";
$.fillcolor="#E1F4FF";
// maybe redo $.label
}
N[_type=="subprocess"]{
$.shape="record";
$.style="filled";
$.color="#FFFFFF";
$.fillcolor="#A5A5A5";
$.label=sprintf("|%s|", $.label); // embed in pipes
}
N[_type=="database"]{
$.shape="cylinder";
$.color="#18589A";
}
N[_type=="inputoutput"]{
$.shape="polygon";
$.style='filled';
$.fontcolor="white",
$.ixedsize="true";
$.skew="0.3";
$.margin="0";
$.width="2";
}
N[_type=="file"]{
$.shape="folder";
}
N[_type=="external"]{
$.shape="box3d";
}
产生:
关于graphviz - 设置预定义的节点样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63140881/
我对我接管的项目有疑问。我正在转换其他人编写的 MS Access 应用程序并将其转换为 MySQL/PHP Web 应用程序。其中大部分已经完成,但是,当涉及到此应用程序的调度部分时,我处于停滞状态
我有一个带有 @Scheduled 注释的方法。此方法包含长时间运行、昂贵的操作。我担心当计划的方法开始运行时应用程序会变慢。有什么办法可以为预定方法分配优先级吗?在 Spring 中启动低优先级后台
我的大学有一个预订项目房间的网站;但除非你很幸运或者半夜醒着,否则要订到房间并不容易。因此,我编写了一个 JS 片段来填写所有必要的字段并提交表单。 但是我如何自动化这个过程呢? 我的目的基本上是加载
我正在评估处理大量排队消息的可能解决方案,这些消息必须在特定日期和时间交付给工作人员。执行它们的结果主要是对存储数据的更新,它们最初可能是也可能不是由用户操作触发的。 例如,想想你在一个假设的大型星际
@Scheduled documentation here声明 fixedRateString值可以是 the delay in milliseconds as a String value, e.g
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 4年前关闭。 Improve t
我有一个有趣的情况。我解析了几个新闻发布网站,想通过调度程序将它们保存到数据库中。但是保存时出现错误。由于交易后写条件 described here . 我的模型类是 @Entity @Table(n
我正在阅读 Java Concurrency in Practice 并遇到以下代码片段。 public static void timedRun(final Runnable r,
使用 Azure 数据工厂,是否可以对驻留在 Azure SQL 数据库中的多个(不是全部)表中的所有行执行预定的 1:1 复制/克隆到另一个 Azure SQL 数据库(在本例中为 Azure SQ
我是一名优秀的程序员,十分优秀!