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