我嘗試在angularjs web應用程序上使用raphael庫和jQuery實現餅圖。有沒有簡短的方法來做到這一點?如何在AngularJS中使用jQuery
在評論你必須撥弄工作代碼。
感謝您的回答。
我嘗試在angularjs web應用程序上使用raphael庫和jQuery實現餅圖。有沒有簡短的方法來做到這一點?如何在AngularJS中使用jQuery
在評論你必須撥弄工作代碼。
感謝您的回答。
這是一個傳導線路:
myapp.directive('rafaelPie',
'$q',
function ($compile, $q) {
'use strict';
return {
restrict: 'A',
scope: {
values:"=values",
width:"@width",
height:"@height",
labels:"=labels"
},
link: function postLink(scope, element, attr, ctrl) {
/*Create first pie raphael*/
var pie = Raphael(element[0], scope.width, scope.height).pieChart(350, 350, 200, values, labels, "#fff");
/*Wath value */
scope.$watch(scope.values, function (newValue, oldValue) {
pie.updateyourvalue();
});
scope.$watch(scope.label, function (newValue, oldValue) {
pie.updateyourvalue();
});
}
};
}
在您的angularview
<div id="holder" rafael-pie width="700" height="700" ></div>
您可以使用指令awesomechart,
<awesomechart type="pie" id='chart2' width="400" height="400" data="data">
</awesomechart>
你有可視化 類似的東西http://raphaeljs.com/pie.html ..like任何例子在我的小提琴,但有沒有includ右拉庫爾的庫 否則看起來不錯...謝謝你 – rikkima 2013-05-01 08:35:35
http://jsfiddle.net/HUvqR/ – rikkima 2013-05-01 08:12:57