2014-11-04 61 views
1

我已经在指令中入侵了包含简单饼图的指令。下面是jsfiddle的确切示例。但是,一旦我试图将其移动到我的网络应用程序,我得到的图形是建立在以前的会议(叠加)之上,但没有动画。我没有控制台错误。当我为数据做日志时,数据传递正确。D3动画(过渡)不适用于Angular应用程序

这是我目前使用的软件: AngularJS V1.2.1, D3版本: “3.4.13”, 正由Express和托管的NodeJS。

任何可能导致此错误的建议。我不想每次获取新数据时都要重置SVG,我希望能够平滑过渡。

var App = angular.module('App', ['ngRoute', 'ngCookies']); 
App.directive('barsChart', function($parse) { 
d3.edge = {}; 

d3.edge.donut = function module() { 

    var width = 460, 
     height = 300, 
     radius = Math.min(width, height)/2; 

    var color = d3.scale.category20(); 
    .............//rest is the same as the js fiddle example 
+0

[found this stack](http://stackoverflow.com/questions/13740164/d3-js-transition-not-working-when-browser-is-minimised)可以帮助我找出为什么这不起作用。 ** requestAnimationFrame **可能导致动画不起作用。 – 2014-11-04 19:33:47

回答

1

在ang angularjs/D3js Web应用程序上工作我发现我导入了一些导致D3转换崩溃的库。以下是导致d3动画崩溃的其他库列表: -Bootstrap v2.0.4 -Bootstrap Responsive v2.0.4 -Date.js(网站:http://www.datejs.com/http://www.coolite.com/datejs/)。 一旦这些库被禁用。我能够看到并使用转场。

相关问题