我还没有使用 D3 找到这个问题的答案。我正在从 svg 元素制作一个矩形工具提示,单击节点后会显示在图表上。与工具提示关联的文本(来自图表的 json)当前仅水平延伸,即使工具提示的尺寸是垂直延伸的。我希望矩形垂直环绕文本(如回车),而不是水平环绕文本,给定矩形的固定宽度。
下面是我在单击节点时创建工具提示的位置:
nodes.on("click", function (d){
if (tip){ tip.remove()};
tip = svg.append("g")
.attr("id", "tip")
.attr("transform", "translate(" + (d3.event.pageX - 10) + "," + (d3.event.pageY - 35) + ")");
let rect = tip.append("rect")
.style("fill", "white")
.style("stroke", "steelblue");
tip.append("text")
.text(d.description)
.attr("dy", "1em")
.attr("x", 5);
let bbox = tip.node().getBBox();
rect.attr("width", bbox.width + 5)
.attr("height", bbox.height)
});
Run Code Online (Sandbox Code Playgroud)
这是具有当前功能的 jsfiddle:https ://jsfiddle.net/Thegreatmochi/epy6514t/14/
最近对我的存储库的提交使 .m 文件之一的代码看起来像普通的纯文本(下面的片段图像)——没有彩色关键字或任何东西。不过其他 .m 文件预览看起来很正常。我看不到带有非彩色预览的文件与其他文件之间的任何明显差异。这有点不方便,因为如果没有颜色,扫描 GitHub 上的代码预览效率会降低。我再次尝试推动,它是一样的。有没有办法来解决这个问题?
由于某种原因,我的虚拟机上的 jupyter 笔记本处于错误的环境中(即卡在(base))。此外,我可以更改终端中的环境,但不能更改笔记本中的环境。!conda activate desired_env这是我在笔记本中尝试时发生的情况:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
# conda environments:
#
base * /anaconda
azureml_py36 /anaconda/envs/azureml_py36
azureml_py38 /anaconda/envs/azureml_py38 …Run Code Online (Sandbox Code Playgroud) virtual-machine azure conda jupyter-notebook azure-machine-learning-service
azure ×1
azure-machine-learning-service ×1
conda ×1
d3.js ×1
github ×1
javascript ×1
matlab ×1
svg ×1