SVG的marker-end显示不出来的问题

简介: 问题描述: 用d3画的图,svg和div重叠画的,svg画连线和箭头,div上用d3来append出个性化的展示面板,项目首页有 <base href="/">,d3生成的svg的标签文件单独复制出来后可以看到箭头(marker-end)!解决方案The HTML element is used to say “resolve all relative

问题描述:
用d3画的图,svg和div重叠画的,svg画连线和箭头,div上用d3来append出个性化的展示面板,项目首页有 <base href="/">,d3生成的svg的标签文件单独复制出来后可以看到箭头(marker-end)!

解决方案

The HTML element is used to say “resolve all relative URLs relative not to this page, but to a new location”. In your case, you’ve told it to resolve relative to the directory with the HTML page.

The SVG marker-mid=”url(…)” attribute is a FuncIRI Reference. When you use a value like url(#foo) that relative IRI is normally resolved relative to the current page, finding the element with the foo id. But, when you use , you change where it looks.

To solve this problem, use a better value. Since your base reference is the current directory, you can simply use the name of the current file:

<line … marker-mid="url(this_page_name.html#arrow)" />

If you have a different href, than what you’ve shown, like:

<base href="http://other.site.com/whee/" />

then you will need to use an absolute href, e.g.

<line … marker-mid="url(http://my.site.com/this_page_name.html#arrow)" />

如果用的Angular, 可以用$location.path!

目录
相关文章
leaflet之自定义marker Icon
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/gisdoer/article/details/82454606 leaflet之自...
3668 0
|
8月前
|
移动开发 前端开发 JavaScript
HTML5 Canvas自定义圆角矩形与虚线(Rounded Rectangle and Dash Line)
HTML5 Canvas自定义圆角矩形与虚线(Rounded Rectangle and Dash Line)
89 3
19Echarts - 折线图(Click to Add Points)
19Echarts - 折线图(Click to Add Points)
50 0
49Echarts - 柱状图(Mixed Line and Bar)
49Echarts - 柱状图(Mixed Line and Bar)
58 0
106Echarts - K 线图(Axis Pointer Link and Touch)
106Echarts - K 线图(Axis Pointer Link and Touch)
45 0
16Echarts - 折线图(Line Chart in Cartesian Coordinate System)
16Echarts - 折线图(Line Chart in Cartesian Coordinate System)
55 0
32Echarts - 柱状图(Bar Label Rotation)
32Echarts - 柱状图(Bar Label Rotation)
64 0
23Echarts - 折线图(Step Line)
23Echarts - 折线图(Step Line)
88 0
【MATLAB】基本绘图 ( Marker 设置 | 设置 Marker 边框 | 设置 Marker 填充 )
【MATLAB】基本绘图 ( Marker 设置 | 设置 Marker 边框 | 设置 Marker 填充 )
1070 0
【MATLAB】基本绘图 ( Marker 设置 | 设置 Marker 边框 | 设置 Marker 填充 )
ListView列宽自适应,设置ListView.Column[0].Width := -1;
使用TListView列表显示内容,如果列内容过长,就会显示成‘XXX…’形式,此时如果双击列标题,列宽将变为自适应。用代码设置如下: 1、设置ListView.Column[0].Width := -1;//列宽根据列内容自适应,此时保证列内容都可见。
3148 0