如何使用JSON绘制SVG折线[关闭]

li9yvcax  于 2023-10-21  发布在  其他
关注(0)|答案(1)|浏览(119)

已关闭,此问题需要details or clarity。它目前不接受回答。
**想改善这个问题吗?**通过editing this post添加详细信息并澄清问题。

4天前关闭。
Improve this question

"markers": [
        {
            "Type": "hello",
            "ID": "4214",
            "Name": "75915",
            "points": [
                4578.3,
                780.0
            ]
        },
        {
            "Type": "hello",
            "ID": "1196",
            "Name": "SD484",
            "Point": [
                82.0,
                875.0
            ]
        }
]

这里我想得到Point作为x和y
我试过很多方法,但都不起作用。

vwoqyblh

vwoqyblh1#

关于以下几点....

viewbox = '0 0 5000 2500';

data = {"markers": [ { "Type": "hello", "ID": "4214", "Name": "75915", "points": [ 4578.3, 780.0 ] }, { "Type": "hello", "ID": "1196", "Name": "SD484", "Point": [ 82.0, 875.0 ] } ]}

points = data.markers.map(marker => `${marker.points[0]}, ${marker.points[1]} `);
<svg  [attr.viewBox]="viewbox">
  <svg:polyline [attr.fill]="'none'" stroke="black" stroke-width="1" [attr.points]="points">
  </svg:polyline>
</svg>

相关问题