原創|行業資訊|編輯:郝浩|2013-10-15 17:31:46.000|閱讀 2461 次
概述: 在本文中將以示例說明如何使用Kendo UI Web中的Kendo UI DataViz添加儀表和圖表。下面的示例將說明如何添加一個圖表到現有的頁面,具體的示例如下。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
在本文中將以示例說明如何使用Kendo UI Web中的Kendo UI DataViz添加儀表和圖表。下面的示例將說明如何添加一個圖表到現有的頁面,具體的示例如下:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>My Kendo UI Application</title> </head> <body> <header> <h1>My Kendo UI Application</h1> </header> <!-- page content goes here --> <div role="main"> </div> <footer> <p>Kendo UI FTW!</p> </footer> </body> </html> 第一步是為jQuery 和Kendo UI DataViz添加腳本和樣式表引用: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>My Kendo UI Application</title> <!-- CDN-based stylesheet reference for Kendo UI DataViz --> <link rel="stylesheet" href="//cdn.kendostatic.com/2012.2.710/styles/kendo.dataviz.min.css"> </head> <body> <header> <h1>My Kendo UI Application</h1> </header> <!-- page content goes here --> <div role="main"> </div> <footer> <p>Kendo UI FTW!</p> </footer> <!-- CDN-based script reference for jQuery; utilizing a local reference if offline --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')</script> <!-- CDN-based script reference for Kendo UI DataViz; utilizing a local reference if offline --> <script src="//cdn.kendostatic.com/2012.2.710/js/kendo.dataviz.min.js"></script> <script>(window.kendo && window.kendo.dataviz) || document.write('<script src="js/kendo.dataviz.min.js"><\/script>')</script> </body> </html>
下面就是要為圖表聲明一個目標元素,將會由一個div元素代表,還需要一個腳本塊初始化和配置區域圖,下面就是一個隨著數據的區域圖示例。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>My Kendo UI Application</title> <!-- Kendo UI HTTP CDN style reference for DataViz --> <link rel="stylesheet" href="//cdn.kendostatic.com/2012.2.710/styles/kendo.dataviz.min.css"> </head> <body> <header> <h1>My Kendo UI Application</h1> </header> <!-- page content goes here --> <div role="main"> <!-- chart/gauge --> <div id="chart"> </div> </div> <footer> <p>Kendo UI FTW!</p> </footer> <!-- Google CDN reference for jQuery; utilizing a local reference if offline --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')</script> <!-- Kendo UI HTTP CDN script reference for DataViz; utilizing a local reference if offline --> <script src="//cdn.kendostatic.com/2012.2.710/js/kendo.dataviz.min.js"></script> <script>(window.kendo && window.kendo.dataviz) || document.write('<script src="js/kendo.dataviz.min.js"><\/script>')</script> <script> // .ready() to initialise and configuration chart/gauge jQuery(document).ready(function($) { $("#chart").kendoChart({ series: [ { name: "United States", data: [67.96, 68.93, 75, 74, 78] }, { name: "World", data: [15.7, 16.7, 20, 23.5, 26.6] } ], seriesDefaults: { type: "area" }, width: 400 }); }); </script> </body> </html>
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網