当为SVG多边形的动画提供初始开始时间时,以下代码可以正常工作.但我无法弄清楚如何通过javascript/jquery触发它而不提供"vbanim"动画的开始时间.
$('button').click(function() {
$('#v-b').beginElement();
})Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Click to draw</button>
<svg width="100px" height="100px" preserveAspectRatio="false" viewBox="0 0 500 800">
<polygon points="20,20 490,20 490,780 20,780" stroke="black" fill="transparent" stroke-width="2" id="v-b" stroke-dasharray="3000"/>
<animate xlink:href="#v-b" attributeName="stroke-dashoffset" from="3000" to="0" dur="2s" begin="indefinite" fill="freeze" id="vbanim"/>
<animate xlink:href="#v-b" attributeName="fill" from="transparent" to="rgba(130,130,130,0.6)" dur="1s" begin="vbanim.end" fill="freeze"/>
</svg>Run Code Online (Sandbox Code Playgroud)
我需要在单击按钮之后才发生stroke-dashoffset和fill动画,在此之前,SVG根本不应该是可见的.谢谢您的帮助.
我需要修改数据框的每一列的值,以便在映射后将它们全部括在双引号中,但数据框仍保留其带有标题的原始结构。
我尝试通过将行更改为序列来映射值,但它在输出数据帧中丢失了其标头。
将其作为输入数据框读入:
|prodid|name |city|
+------+-------+----+
|1 |Harshit|VNS |
|2 |Mohit |BLR |
|2 |Mohit |RAO |
|2 |Mohit |BTR |
|3 |Rohit |BOM |
|4 |Shobhit|KLK |
Run Code Online (Sandbox Code Playgroud)
我尝试了以下代码。
val columns = df.columns
df.map{ row =>
row.toSeq.map{col => "\""+col+"\"" }
}.toDF(columns:_*)
Run Code Online (Sandbox Code Playgroud)
但是它抛出错误,指出映射的数据帧中只有1个标头,即值。这是实际结果(如果我删除了“ .df(columns:_ *)”):
| value|
+--------------------+
|["1", "Harshit", ...|
|["2", "Mohit", "B...|
|["2", "Mohit", "R...|
|["2", "Mohit", "B...|
|["3", "Rohit", "B...|
|["4", "Shobhit", ...|
+--------------------+
Run Code Online (Sandbox Code Playgroud)
我的预期结果是:
|prodid|name |city |
+------+---------+------+
|"1" |"Harshit"|"VNS" |
|"2" |"Mohit" |"BLR" |
|"2" |"Mohit" …Run Code Online (Sandbox Code Playgroud) apache-spark ×1
css ×1
dataframe ×1
html ×1
javascript ×1
jquery ×1
mapping ×1
rdd ×1
scala ×1
svg ×1