我希望将html附加到D3中的矩形上,以便为我提供多行工具提示.底部是我如何添加一个矩形,这可能是问题的一部分.顶部是应该在我的世界中工作的代码.
newRect.().html(" <textArea font-family=Verdana font-size=20 fill=blue > Test " + "</br>" + "Test2 </textArea>");
Run Code Online (Sandbox Code Playgroud)
哪个插入文本字段到SVG,它只是不显示:
HTML:
<rect id="rectLabel" x="490" y="674" width="130" height="160" fill="red">
<textarea fill="blue" font-size="20" font-family="Verdana"> Test </br>Test2 </textarea>
</rect>
Run Code Online (Sandbox Code Playgroud)
我有一个鼠标悬停功能,运行如下:
newRect = svg.append("rect")
.attr("x", xCor)
.attr("y", yCor)
.attr("width", 130)
.attr("height", 160)
.attr("fill", "red")
.attr("id", "rectLabel");
Run Code Online (Sandbox Code Playgroud)
我想我应该这样做,但它不起作用.它只是删除了我想要追加的g.node.
newRect = $(this).enter().append("rect")
.attr("x", xCor)
.attr("y", yCor)
.attr("width", 130)
.attr("height", 160)
.attr("fill", "red")
.attr("id", "rectLabel");
Run Code Online (Sandbox Code Playgroud)
问题:为什么我的文字没出现?我试过.html,.textArea.我想要一个多行标签,所以我不认为.text会正常工作吗?另外,我应该如何追加矩形呢?
我正在寻找使用D3创建带有浮动标签的饼图.我是D3的新手,我甚至不确定这是可能的吗?你能以某种方式使用另一张图的标签吗?如果可以的话,你能指点我一个例子吗?
更短的说明:我想要标签:http: //bl.ocks.org/1691430
...在饼图上.
这是我在下面运行的代码:或者在JSBIN中:http://jsbin.com/awilak/1/edit
如果我正确理解他的代码,这是添加标签的部分.我不明白labelForce.update的作用.从那里,我不关心过渡,所以不需要这条线.然后其余的只是绘制圆圈并添加链接/线?如果有人可以整合那将是惊人的,但如果你可以帮助我了解正在发生的事情和我错过的东西,我将不仅仅是感激.
// Now for the labels
// This is the only function call needed, the rest is just drawing the labels
anchors.call(labelForce.update)
labels = svg.selectAll(".labels")
.data(data, function(d,i) {return i;})
labels.exit()
.attr("class","exit")
.transition()
.delay(0)
.duration(500)
.style("opacity",0)
.remove();
// Draw the labelbox, caption and the link
newLabels = labels.enter().append("g").attr("class","labels")
newLabelBox = newLabels.append("g").attr("class","labelbox")
newLabelBox.append("circle").attr("r",11)
newLabelBox.append("text").attr("class","labeltext").attr("y",6)
newLabels.append("line").attr("class","link")
labelBox = svg.selectAll(".labels").selectAll(".labelbox")
links = svg.selectAll(".link")
labelBox.selectAll("text").text(function(d) { return d.num})
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; …Run Code Online (Sandbox Code Playgroud) 我的github没有连接.我已经尝试了两台不同的计算机而且我得到了同样的错误,所以我做错了.当我运行时,git push我会按预期提示输入用户名/密码.输入它们,是的我输入正确.然后它说:
fatal: Authentication failed
Run Code Online (Sandbox Code Playgroud)
但是当我输入ssh -T git@github.com它时会提示我输入密码,输入后,它会欢迎我使用github.我已经尝试再次添加SSH密钥,它说的是这个SSH密钥已经在帐户上了.有人让我知道我错过了什么?
当我尝试登录时显示:
Password for http://(UserName)@www.github.com:
那是对的吗?
更多信息:这是ssh-vT git@github.com的输出:
$ ssh-add -l
Could not open a connection to your authentication agent.
Run Code Online (Sandbox Code Playgroud)
_
$ ssh -vT git@github.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to github.com [192.30.252.129] port 22.
debug1: Connection established.
debug1: identity file /l/.ssh/identity type -1
debug1: identity file /l/.ssh/id_rsa type 1
debug1: identity file /l/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debia …Run Code Online (Sandbox Code Playgroud) 我正在使用window.location.href重定向我的浏览器,我不确定为什么一个工作,一个不工作.当我使用相对链接时,它会刷新当前页面.当我使用完整的URL时,它会重定向.我所在的页面和Process.aspx页面位于同一目录级别.所以我应该能够有一个相对链接?当我这样做虽然它只是重新加载我正在的当前页面.关于window.location.href我错过了什么基本想法?
$(document).ready(function() {
$( "button" )
.button();
$("#cancel")
.click(function( event ) {
alert("click");
//Below Line Doesn't work
window.location.href = "/Process.aspx";
//Below Line Does work
window.location.href = "http://localhost:65215/Process.aspx";
});
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Gridview来显示来自Object数据源的数据表.它给了我错误:
ObjectDataSource 'odsStores' could not find a non-generic method 'ProcessDelete' that has parameters: ProcessID.
Run Code Online (Sandbox Code Playgroud)
我已经阅读了关于匹配大小写,匹配格式,变量这个问题的很多其他答案,但我想我已经完成了所有这些.这是aspx页面:
<asp:GridView ID="gridStores" runat="server" AllowSorting="False" AutoGenerateColumns="False"
CssClass="grid-main" DataSourceID="odsStores" EnableViewState="False" OnDataBound="gridStores_DataBound"
OnRowDataBound="gridStores_RowDataBound">
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:Image ID="imgModel" runat="server" AlternateText="Click to See Details" CssClass="img-details"
EnableViewState="False" ImageUrl="~/img/detail.gif" />
</ItemTemplate>
<ItemStyle CssClass="grid-main-detail" />
</asp:TemplateField>
<asp:BoundField DataField="ProcessID" HeaderText="ProcessID" />
<asp:BoundField DataField="ProcessName" HeaderText="Process Name" ReadOnly="False" />
<asp:BoundField DataField="ProcessDescription" HeaderText="Process Description" ReadOnly="False" />
<asp:BoundField DataField="UpdateUserID" HeaderText="Last Updated By" ReadOnly="True" />
<asp:BoundField DataField="UpdateTimestamp" HeaderText="Last Updated" ReadOnly="True" />
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowDeleteButton="True" /> …Run Code Online (Sandbox Code Playgroud) 在这种情况下执行函数(getAvailableLabs)之后 - 我想执行回调或承诺.我不确定我应该执行哪个但是我无法工作.
路线:
router.get('/api/content_left', function(req, res, next){
const Labs = require("../models/Labs.js");
l = new Labs("Sample Lab", "Sample Description", "Sample Category", "Sample Tech");
l.getAvailableLabs(function(){
console.log("We made it here!");
});
console.log("This is post resposnse");
Run Code Online (Sandbox Code Playgroud)
Labs.js:
getAvailableLabs() {
var d = db.any('select * from labs')
.then(data => {
console.log(data[0]);
return data
})
.catch(function (error) {
console.log(error + " - Error in function");
return error;
});
}
Run Code Online (Sandbox Code Playgroud)
在上述情况下,它记录"可用实验室结束",然后是"这是后响应".这就是我对回调理解的期望.然而它永远不会执行"我们在这里做到了!" 我不明白为什么?我的印象是,如果我在函数中放置一个函数 - 它将作为回调执行,但这不会发生.我是否需要以特定方式返回执行回调?
谢谢您的帮助.
javascript ×4
d3.js ×2
asp.net ×1
browser ×1
callback ×1
dataadapter ×1
force-layout ×1
git-bash ×1
github ×1
label ×1
node.js ×1
pie-chart ×1
redirect ×1
svg ×1
vb.net ×1