用1分钟在HTML中创建图表






4.33/5 (2投票s)
用1分钟在HTML中创建图表
要将图表添加到您的页面,您只需要一分钟。我们将使用 AWeb库。让我们将库连接到项目
<!DOCTYPE HTML>
<html>
<head>
<title>Sample project</title>
<!-- Styles -->
<link rel="stylesheet" type="text/css" href="http://a-web.me/styles/default/a-web.css" >
<!-- Scripts -->
<script type="text/javascript" src="http://a-web.me/scripts/a-web.js"></script>
</head>
<body>
</body>
</html>
图表通过标签 "a:chart
" 创建,图表属性在标签属性中指定。x轴将显示从1到3的值,比例为1。y轴将显示从1到10的值,比例为5。图表经过点:(1,0) (2,8) (3,0)。
我们的示例将如下所示
<!DOCTYPE HTML>
<html>
<head>
<title>Sample project</title>
<!-- Styles -->
<link rel="stylesheet" type="text/css" href="http://a-web.me/styles/default/a-web.css" >
<!-- Scripts -->
<script type="text/javascript" src="http://a-web.me/scripts/a-web.js"></script>
</head>
<body>
<!-- Chart -->
<a:chart a:type="UI/Chart"
a:axis-x="1..3/1"
a:axis-y="0..10/5"
a:points-1="1 0, 2 8, 3 0"
>
</a:chart>
</body>
</html>
图表在客户端浏览器中创建,无需连接服务器。尽情享受吧!
关于该库的其他文章
我决定链接这些文章,因为互联网上关于该库的信息不多