加载中...

分组


调试运行

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>图形展示</title>
</head>
<body>
 
<div class="detail-section">
    <div id="canvas">
 
    </div>
</div>
 
<script src="http://g.tbcdn.cn/bui/acharts/1.0.32/acharts-min.js"></script>
<!-- https://g.alicdn.com/bui/acharts/1.0.29/acharts-min.js -->
 
 
  <script type="text/javascript">
    
      //创建画板
      var canvas = new AChart.Canvas({
        id : 'canvas',
        height : 400,
        width : 500
      });
 
      var group = canvas.addGroup({
        elCls : 'group12'
      });
 
      canvas.addGroup({
        id : 'my-group',
        x : 100,
        y : 100
      });
 
      group.addShape('circle',{
        cx : 125,
        cy : 100,
        r : 20,
        fill : '#2f7ed8',
        stroke : ''
      });
 
      group.animate({ //分组的动画仅支持平移
        x : 300,
        y : 200
      },1000);
 
      //通过id查找分组
      var mygroup = canvas.find('my-group');
 
      mygroup.addShape('rect',{
        x : 0,
        y : 0,
        height: 100,
        width : 100,
        fill : 'red',
        'fill-opacity':.5,
        stroke : 'yellow'
      });
      
      </script>
 
</body>
</html>

还没有评论.