<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>拖拽操作</title>
</head>
<body>
<script src = "d3.js"></script>
<script>var width =2000,height = 2000;var svg = d3.select("body").append("svg").attr("width",width).attr("height",height)var color = d3.scale.category20()//定义拖拽函数var drag = d3.behavior.drag().on("drag",dragmove)function dragmove(d){d3.select(this).attr("cx", d.cx = d3.event.x).attr("cy", d.cy = d3.event.y)}//绘制圆形var circles =[{cx:150,cy:200,r:30},{cx:250,cy:200,r:30}]svg.selectAll("circle").data(circles).enter().append("circle
详细解决方案
d3.js——图形拖拽操作
热度:57 发布时间:2024-01-18 01:24:09.0
相关解决方案