扩展:QuickGV

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Extension:QuickGV and the translation is 89% complete.

Other languages:
Deutsch • ‎English • ‎dansk • ‎español • ‎polski • ‎sicilianu • ‎中文 • ‎日本語
MediaWiki扩展手册
OOjs UI icon advanced.svg
QuickGV
发布状态: 稳定版
Quickgv-sample-default.png
实现 Tag
描述 用少量的代码绘图。
作者 Raymond Wu (小璋丸talk)
最新版本 0.2.3 (2016-03-18)
数据更新
许可协议 Apache v2
下载
Cache mechanism
例子 http://www.graphviz.org/Gallery.php
标签
<quickgv>
使用的钩子
ParserFirstCallInit
翻译QuickGV扩展如果在translatewiki.net可用
检查使用和版本矩阵。

QuickGV扩展帮助你用少量的代码绘图。

你只需要 "定义节点和边" ,样式不需要自己来。

如何使用

只有一个标签

默认图

<quickgv name="nothing" />

Quickgv-sample-default.png


元数据

默认的图与元数据

<quickgv name="withmeta" showmeta="true"/>

Quickgv-sample-showmeta.png


用法选项

ER模型 (usage="er")

Quickgv-sample-ermodel.png

<quickgv name="ER_Model" usage="er">
   // node 123456789012345678901
   A [label="<fT> user_data | <fPK> [PK] user_id\l | <f0> user_type\l | <f1>gender\l | <f2> country\l | <f3> city\l }"];
   B [label="<fT> user_type | <fPK> [PK] user_type\l | desc\l"];
   C [label="<fT> gender | <fPK> [PK] gender\l | desc\l"];

   // edges
   A:f0 -> B:fPK [label="1 .. N"];
   A:f1 -> C:fPK [label="1 .. N"];
   A:f3 -> A:f2;
</quickgv>

Mindmap (usage="mindmap")

Quickgv-sample-mindmap.png

<quickgv name="MM" usage="mindmap">
start = "A";

A [label="Project"];
B1 [label="Budget"];
B2 [label="Risk"];
B3 [label="Members"];

A -> {B1 B2 B3};
</quickgv>

主题选项

默认 (theme="default")

Quickgv-sample-theme-default.png

<quickgv name="Pointer1" usage="ram">
   A [label="RAM (0x71xx) | 0x710c\l | 0x7108\l | <fsrc> 0x7104 - 0x830c\l (int* a) | 0x7100\l "];
   B [label="RAM (0x83xx) | <fdst> 0x830c - 0x00ff\l | 0x8308\l | 0x8304\l | 0x8300\l"];
   A:fsrc -> B:fdst [label="a = 0x830c;\l*a = 0x00ff;\l"];
</quickgv>

冷色调 (theme="cold")

Quickgv-sample-theme-cold.png

<quickgv name="Pointer2" usage="ram" theme="cold">
   A [label="RAM (0x71xx) | 0x710c\l | 0x7108\l | <fsrc> 0x7104 - 0x830c\l (int* a) | 0x7100\l "];
   B [label="RAM (0x83xx) | <fdst> 0x830c - 0x00ff\l | 0x8308\l | 0x8304\l | 0x8300\l"];
   A:fsrc -> B:fdst [label="a = 0x830c;\l*a = 0x00ff;\l"];
</quickgv>

暖色调 (theme="warm")

Quickgv-sample-theme-warm.png

<quickgv name="Pointer3" usage="ram" theme="warm">
   A [label="RAM (0x71xx) | 0x710c\l | 0x7108\l | <fsrc> 0x7104 - 0x830c\l (int* a) | 0x7100\l "];
   B [label="RAM (0x83xx) | <fdst> 0x830c - 0x00ff\l | 0x8308\l | 0x8304\l | 0x8300\l"];
   A:fsrc -> B:fdst [label="a = 0x830c;\l*a = 0x00ff;\l"];
</quickgv>

樱花 (theme="sakura")

Quickgv-sample-theme-sakura.png

<quickgv name="Pointer4" usage="ram" theme="sakura">
   A [label="RAM (0x71xx) | 0x710c\l | 0x7108\l | <fsrc> 0x7104 - 0x830c\l (int* a) | 0x7100\l "];
   B [label="RAM (0x83xx) | <fdst> 0x830c - 0x00ff\l | 0x8308\l | 0x8304\l | 0x8300\l"];
   A:fsrc -> B:fdst [label="a = 0x830c;\l*a = 0x00ff;\l"];
</quickgv>

Attribute Reference

Attribute 可用值 描述
name RegExp: [a-zA-Z0-9_]+ 图的名称(默认为G)
showmeta true, false 设置为true来显示元数据(默认为false)
showdot true, false Set true to show dot source code. (default false)
theme default, cold, warm, sakura See theme option.
usage default, neato (mindmap), record (er, ram) See usage option.

安装

安装仓库

第一步:从GitHub安装

cd /path/to/wiki/extensions
git clone https://github.com/virus-warnning/mw-quickgv.git QuickGV

安装zip包

第一步:安装zip包

QuickGV Releases下载ZIP包

  • 解压包
  • 将mw-quickgv重命名为QuickGV

第二步:应用该扩展

将以下代码附加至LocalSettings.php

require_once("$IP/extensions/QuickGV/QuickGV.php");

条件

  • Graphviz 2.38 or later
    • OSX: brew install graphviz
    • CentOS: yum install graphviz
    • Ubuntu: sudo apt-get install graphviz
    • Windows: Install from an Installer package (Tested on Win7)
  • PHP 5.x, and need these functions
    • exec()
    • proc_open()
    • proc_close()

Changelog

  • 0.2.4 (Latest)
    • Extension registration.
    • JSON format language file.
  • 0.2.3 (2016-03-18)
    • Support URL attribute of node, open the link in new tab.
    • Set arrowsize=0.6.
    • Set splines=ortho for usage not set.
    • Set splines=curved for usage="neato".
    • Set splines=spline for usage="record".

The project is hosted at wikimedia.org since 0.2.4, see project dashboard.