在D3中绘制复杂的形状

时间:2016-06-06 22:35:19

标签: d3.js svg graphics

我正在尝试为D3动画绘制不规则的花瓣形状,但我找不到任何可理解的SVG格式奇怪形状的文档。我怎么能创造这样的形状? Rose-petal shape

1 个答案:

答案 0 :(得分:2)

它是这样的:

[
    {"day":"11,10,2016","visitors":918,"u":123},
    {"day":"12,10,2016","visitors":980,"u":203},
    {"day":"13,10,2016","visitors":928,"u":103},
    {"day":"14,10,2016","visitors":928,"u":523},
    {"day":"15,10,2016","visitors":928,"u":300},
    {"day":"16,10,2016","visitors":918,"u":120},
    {"day":"17,10,2016","visitors":983,"u":223}
]

并用作定义(defs)以供将来参考。看here

在这里:Is it possible to import svg shapes in d3.js?

如果您想手动完成,请参阅路径教程:https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths

这里是Codepen