Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / HTML5

Chart in HTML in 1 Minute

4.33/5 (2 votes)
25 Sep 2013CPOL 24.2K  
Chart in HTML in 1 minute

To add a chart to your page, you will need exactly one minute. We will use AWeb library. Let's connect the library to the project:

HTML
<!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>

Chart is created by tag "a:chart", chart properties are specified in the tag attributes. The x-axis will display the values from 1 to 3, scale 1. The y-axis will display the values from 1 to 10, scale 5. Chart passes through: (1,0) (2,8) (3,0).

Our example will look like this:

HTML
<!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>

The chart is created on the client side in the browser without connecting to the server. Enjoy!

Other Articles About the Library

I decided to link the articles, because there is not much information about the library on the internet:

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)