1
我目前使用Dev Extreme在使用AngularJS構建的單頁webapp中生成一些圖。 在教程Documentation-DevExtreme之後,我創建了一個模板。除了我在控制器裏面寫的。
以下是我的代碼:DevExtreme dxChart()無法縮放/滾動/響應值更改(使用AngularJS)
// This controller manages views in basic.html
app.controller("basicCtrl", ["$scope", "$http",
function ($scope, $http) {
function find(str, raw) {}
$scope.method = "GET";
$scope.url = "test.json";
$scope.BindWidget = function() {
var data = $scope.data;
// console.log(data);
// get data
var peopleStreamData = find("peopleStream", data);
if (peopleStreamData !== null) {
var chartOptions = {
dataSource: peopleStreamData.dataSource,
series: peopleStreamData.series,
scrollBar: {
visible: true
},
scrollingMode: "all",
zoomingMode: "all",
};
$("#peopleStream").dxChart(chartOptions);
$("#whatever").dxRangeSelector({
//some other options here I hid
behavior: {
callSelectedRangeChanged: "onMoving"
},
onSelectedRangeChanged: function (e) {
var zoomedChart = $("#peopleStream").dxChart('instance');
zoomedChart.zoomArgument(e.startValue, e.endValue);
}
});
}
};
$scope.fetch = function() {
$http({method: $scope.method, url: $scope.url, cache: false}).
success(function (data, status) {
$scope.status = status;
$scope.data = data;
// call the function to generate widgets
$scope.BindWidget();
}).
error(function (data, status) {
console.log("SHIT, FAILED TO READ JSON");
$scope.data = data || "Request failed";
$scope.status = status;
});
};
$("document").ready($scope.fetch());
}]);
和HTML:
<body>
<div id="peopleStream"></div>
<div id="whatever"></div>
</body>
出於某種原因,滾動條顯示不出來,都不會更改在我的主圖表rangeSelector改變任何東西。 任何人有任何這方面的經驗?
這很奇怪 - 在我的例子中'scrollBar:{visible:true},scrollingMode:「all」,zoomingMode:「all」,'就足以讓滾動條出現。至於'onSelectedRangeChanged' - 範圍選擇器的域和圖表是否一致?即在圖表的參數軸範圍內有e.startValue和e.endValue? – Sergey 2015-02-11 07:46:14
是的。我仍然不知道這是什麼原因造成的...... – 2015-02-11 11:34:05
你試過他們的支持中心嗎? – Sergey 2015-02-11 13:30:16