我正在为我的公司开发一个小型的内部应用程序来可视化一些业务数据。为此,我使用了带有DataViz小部件的Kendo UI mobile。我现在认识到的是,当设备翻转时,整个应用程序得到调整(例如从纵向模式到横向模式),但不是DataViz组件。我试过对窗口大小调整事件做出反应,但没有成功。我知道你想看一些代码,在这里:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, target-densitydpi=device-dpi" />
<link href="css/kendo.common.min.css" rel="stylesheet" />
<link href="css/kendo.default.min.css" rel="stylesheet" />
<link href="css/kendo.mobile.all.min.css" rel="stylesheet" />
<script src="cordova.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/kendo.all.min.js"></script>
<script src="js/kendo.dataviz.mobile.min.js"></script>
</head>
<body>
<div id="home" data-role="view" data-layout="main">
<ul data-role="listview" data-style="inset" data-type="group">
<li>
General Overview
<ul>
<li data-icon="toprated"><a href="#orderentry">Order Entry</a></li>
</ul>
</li>
</ul>
</div>
<div id="orderentry" data-role="view" data-layout="sub">
<ul id="oe-buttongroup">
<li>Standard</li>
<li>Ecom</li>
</ul>
<div id="oe-chart"></div>
</div>
<section data-role="layout" data-id="main">
<header data-role="header">
<div data-role="navbar">
<img src="img/also_holding_2013.png">
Live
</div>
</header>
</section>
<section data-role="layout" data-id="sub">
<!--View content will render here-->
<!--<footer data-role="footer">
<div data-role="tabstrip">
<a href="#home" data-icon="globe">Home</a>
</div>
</footer>-->
<header data-role="header">
<div data-role="tabstrip">
<a href="#home" data-icon="globe">Home</a>
</div>
</header>
</section>
<script>
var app = new kendo.mobile.Application(document.body,
{
transition:'slide'
});
var orderentry = new kendo.data.DataSource( {
data: [
{
"category": "Orders",
"value": 5898
}, {
"category": "Positions",
"value": 23756
}, {
"category": "Customers",
"value": 2026
}
]
});
var oechart = $("#oe-chart").kendoChart({
title:[{
text: "Order Entry"
}],
series: [{
field: "value"
}],
categoryAxis: {
field: "category"
}
});
oechart.data("kendoChart").setDataSource(orderentry);
</script>
</body>
</html>
您可以使用chart.redraw
在需要时触发重绘。
oechart.data("kendoChart").redraw();