dot

input的onchange 和oninput事件

白昼怎懂夜的黑 提交于 2020-03-27 18:48:02
一个小的功能,也体现了了这几天写程序过程中的遇到的一些常发事件,准备有时间研究一下jQuery和原生js,问题的出现:使用jQuery获取到的节点到底是属于什么,有些事件 居然不能用,就如我今天用到的事件 onchange 和oninput ,还有对于onclick 和click, 先总结一下这个小小的功能:输入框要输入money,那就只有两位小数,我们要确保输多位小数时,不让他提交,提交按钮变灰色,当小数点后是两位则回复按钮状态, onchange事件,监听input 输入的值是否符合要求,不符合则改变按钮状态:代码如下: bid.onchange=function(){ var num = bid.value; var dot = num.split('.'); if(dot[1]!=null){ if(dot[1].length>2){ var addbtn = document.getElementById("addbtn"); addbtn.setAttribute("disabled",true); alert("请保留两位小数"); } } } oninput事件,随时监听input输入的值,小数点后的位数,当时两位时,按钮回复状态:代码如下: bid.oninput=function(){ var num = bid.value; var dot = num

Annotate DOT graphs with images

倾然丶 夕夏残阳落幕 提交于 2020-03-24 03:20:12
问题 I'm using PyDot to generate Graphviz/dot graphs in python. I would like to annotate my nodes and edges with images read from files, I've found in the documentation how to put an image as a node, but not how to put an image under a node or even less an edge. http://www.graphviz.org/doc/info/attrs.html http://www.graphviz.org/doc/info/shapes.html http://www.graphviz.org/Documentation/html/shapehowto.html Does anybody know how to do that? 回答1: You can use HTML in the labels for nodes and edges.

Graphviz (DOT) Captions

試著忘記壹切 提交于 2020-02-27 14:13:12
问题 I need to print a large number of graphs using Graphviz DOT. To distinguish which input each graph corresponds to, I want to also have a caption for each graph. Is there anyway to embed this into the DOT representation of the graphs. 回答1: You can use label to add a caption to the graph. Example: digraph { A -> B; label="Graph"; labelloc=top; labeljust=left; } labelloc and labeljust can be used to determine top/bottom and left/right position of the graph label. All the details and other

canvas仿芝麻信用分仪表盘

余生长醉 提交于 2020-02-27 02:43:26
这是一个仿支付宝芝麻信用分的一个canvas,其实就是一个动画仪表盘。 首先, 上原图: 这个是在下支付宝上的截图,分低各位见笑了。然后看下我用canvas实现的效果图: <canvas id="canvas" width="400" height="700" data-score='724'></canvas> <!-- 设置data-score,分数区间[400, 900] --> 唉,总感觉不像。这个是GIF图,可能在网页上打开的效果会好一点( 当然可能就是这样 )。大家可以点击底部预览codepen上的演示。有两个不完美的地方,一个是实际上芝麻信用表盘上的的刻度是不均匀的,我这为了简单的实现就采取相同的刻度;二是表盘上运动的点是有模糊的效果,还没解决。唉,下次再说吧。 接下来还是来说说怎么实现的吧。第一步,国际惯例,创建画布: var canvas = document.getElementById('canvas'), ctx = canvas.getContext('2d'), cWidth = canvas.width, cHeight = canvas.height; 然后绘制表盘,虽说不是处女座,但也要尽可能做到跟原图上的一样,那就是这个环形开口的角度是多少呢?请上ps来测一下: 嗯,136°,这个角度确实刁钻,为了方便接下来的计算,那就约等于140°

Graphviz:如何从.dot转到图形?

谁都会走 提交于 2020-02-26 17:34:56
我似乎无法弄清楚。 我有一个.dot文件,根据语法有效。 如何使用graphviz将其转换为图像? (请注意,我使用的是Windows,而不是Linux) #1楼 您也可以以xdot格式输出文件,然后使用JavaScript库canviz在浏览器中呈现文件。 Canviz在code.google.com上 : 要查看示例,截至2014年11月2日,上面的页面上有一个“ Canviz Demo”链接。 #2楼 点file.dot -Tpng -o image.png 这适用于Windows和Linux。 必须安装Graphviz。 #3楼 类型: dot -Tps filename.dot -o outfile.ps 如果要使用点渲染器。 还有其他替代品,例如neato和twopi。 如果graphiz不在您的路径中,请找出它的安装位置并从那里运行。 您可以通过更改 -o 指定的文件名的扩展名来更改 输出格式 。 如果您使用的是Windows,请检查已安装的名为GVEdit的工具,这会使整个过程稍微容易一些。 请转到“用户指南”部分中的graphviz网站,以获取有关如何使用这些工具的更多详细信息: http://www.graphviz.org/documentation/ (例如,有关dot命令的输出格式,请参见第27页) http://www.graphviz.org/pdf

Same node in two subgraphs

三世轮回 提交于 2020-02-25 04:23:25
问题 I want to draw a border around two subgraphs but I have one node that belongs to both. digraph { subgraph cluster_0 { color = red A -> D A -> C C -> D } subgraph cluster_1 { color = blue B -> C B -> E C -> E } } Now C should be part of both Clusters - instead I get this: 回答1: There s a difference between tha name / label of a node and its identification. When a node has no name / label ithe identification is taken as name / label. Not sure if the following is what uou intended (otherwise

graphviz使用

China☆狼群 提交于 2020-02-24 23:18:18
官方网站:http://www.graphviz.org/ Graphviz (Graph Visualization Software) 是一个由AT&T实验室启动的开源工具包。DOT是一种图形描述语言,非常简单的, Graphviz就是用来处理这种语言的工具。只需要简单了解一下DOT语言,就可以用Graphviz绘图了,它对程序员特别有用。 安装 sudo apt -y install graphviz 安装了命令包 使用 无向图 graph graphname { a -- b -- c; b -- d; } 运行命令: dot test.dot -Tpng -o test.png 在当前目录下生成test.png文件 有向图 digraph graphname { a -> b -> c; b -> d; } 设置权重 digraph tr{ a -> b [label="20"]; b -> c [label="30"]; } 二叉树 digraph G { label = "Binary search tree"; node [shape = record]; A [label = "<f0>|<f1>A|<f2>"]; B [label = "<f0>|<f1>B|<f2>"]; C [label = "<f0>|<f1>C|<f2>"]; D [label = "

numpy矩阵乘法中的multiply,matmul和dot

不打扰是莪最后的温柔 提交于 2020-02-22 09:56:37
用numpy做矩阵运算时,少不了用到矩阵乘法。本文帮你迅速区分 multiply , matmul 和 dot 的区别。 numpy官方文档中的说明:(想深入了解可以一戳) multiply : https://docs.scipy.org/doc/numpy/reference/generated/numpy.multiply.html dot : https://docs.scipy.org/doc/numpy/reference/generated/numpy.dot.html matmul : https://docs.scipy.org/doc/numpy/reference/generated/numpy.matmul.html 1. multiply(矩阵点乘) 先说说更简单的multiply, 如果两个维度完全一样的矩阵用multiply做乘法,那么它们只是进行对应位置元素之间的乘法 ,得到一个同样维度的矩阵输出。 import numpy as np a = np.array([[0,1,2], [1,2,3], [3,4,5]]) b = np.array([[1,1,2], [2,2,1], [1,1,2]]) print(np.multiply(a, b)) 输出: array([[ 0, 1, 4], [ 2, 4, 3], [ 3, 4, 10]])

Graphviz same level Vertical Ordering

巧了我就是萌 提交于 2020-02-08 03:26:26
问题 I have a dot graph with many branches. Not sure how to keep the output as the same order while inputing in the script. Here is my codes, digraph { "/home2/groups/" -> Data; CL[label="CL(9+12)"]; CA[label="CA(14+5)"] Data -> CL; Data -> CA; CL -> Cl_batch1; CL -> Cl_batch2; CA -> CA_batch1; CA -> CA_batch2; CA_batch1 -> {ca_a0 [label="G_pipeline"]}; CA_batch1 -> {ca_a1[label="Phe"]}; CA_batch1 -> {ca_a2 [label="QC"]}; CA_batch2 -> {ca_a0 [label="G_pipeline"]}; CA_batch2 -> {ca_a1 [label="Phe"]

numpy基础--线性代数

僤鯓⒐⒋嵵緔 提交于 2020-02-01 17:49:42
以下代码的前提: import numpy as np 线性代数(如矩阵乘法、矩阵分解、行列式以及其他方阵数学等)是任何数组库的重要组成部分。numpy提供了一个用于矩阵乘法的dot函数(既是一个数组方法也是numpy命名空间中的一个函数)。 1 >>> x = np.array([[1, 2, 3], [4, 5, 6]]) 2 >>> y = np.array([[1, 2], [3, 4], [5, 6]]) 3 >>> x 4 array([[1, 2, 3], 5 [4, 5, 6]]) 6 >>> y 7 array([[1, 2], 8 [3, 4], 9 [5, 6]]) 10 >>> np.dot(x, y) 11 array([[22, 28], 12 [49, 64]]) 13 >>> x.dot(y) 14 array([[22, 28], 15 [49, 64]]) 16 >>> numpy.linalg中有一组标准的矩阵分解运算以及诸如求逆和行列式之类的东西。 1 >>> from numpy.linalg import inv, qr 2 >>> X = np.arange(9).reshape(3, 3) 3 >>> X 4 array([[0, 1, 2], 5 [3, 4, 5], 6 [6, 7, 8]]) 7 >>> mat = X.T