Professional Documents
Culture Documents
WAD MNUL 6 To 11
WAD MNUL 6 To 11
WAD MNUL 6 To 11
h1{
font-family:sans-serif;
font-size:24px;
font style:normal;
color:blue;
text-align="center";
text-decorate:underline;
}
table{
height:300;
font-family:verdana;
color: black;
font-size:16px;
font style:normal;
font-weight:bold;
background:linear-gradient(to buttom,#33ccff 0%,#ff99cc 100%);
border-collapse;
border: 4px solid #000000;
border-style: dashed;
}
table.inner{
border: 10px
}
</style>
<title>Application Form</title>
</head>
<body align="center">
<h1>Annamacharya Hostel<h1>
<h1>Student Hostel Application Form</h1>
<form >
Result:
Hence, the Hostel Application Form designed in Module -5 is styled more
beautifully by using Bootstrap CSS is successful.
7. Analyse various HTTP requests &Identifing problems
Task: Analyse various HTTP requests (initiators, timing diagrams, responses) and identify
problems if any.
Aim: To Analyse various HTTP requests and to identify problems.
Description:
HTTP is a transfer protocol used by the World Wide Web distributed hypermedia system
to retrieve distributed objects. HTTP uses TCP as a transport layer. Certain design features
of HTTP interact badly with TCP, causing problems with performance and with server
scalability. Latency problems are caused by opening a single connection per request,
through connection setup and slow-start costs. Further avoidable latency is incurred due to
the protocol only returning a single object per request. Scalability problems are caused by
TCP requring a server to maintain state for all recently closed connections.
Summary of HTTP/1.0
HTTP[http]is a transfer protocol used by the World Wide Web to retrieve information
from distributed servers. The HTTP model is extremely simple; the client establishes a
connection to the remote server, then issues a request. The server then processes the
request, returns a response, and closes the connection.
Requests
The request format for HTTP is quite simple. The first line specifies an object, together
with the name of an object to apply the method to. The most commonly used method is
"GET", which ask the server to send a copy of the object to the client.
The client can also send a series of optional headers; these headers are in RFC-822 format.
The most common headers are "Accept", which tells the server which object types the
client can handle, and "User-Agent", which gives the implementation name of the client.
Request syntax
<METHOD><URI> "HTTP/1.0" <crlf>
{<Header>: <Value><crlf>}*
<crlf>
Example
GET /index.html HTTP/1.0
Accept: text/plain
Accept: text/html
Accept: */*
User-Agent: Yet Another User Agent
Responses
The response format is also quite simple. Responses start with a status line indicating
which version of HTTP the server is running, together with a result code and an optional
message.
This is followed by a series of optional object headers; the most important of these are
"Content-Type", which describes the type of the object being returned, and "Content-
Length", which indicates the length.The headers are teminated by an empty line.
The server now sends any requested data. After the data have been sent, the server drops
the connection.
Response syntax
"HTTP/1.0" <result-code> [<message>] <crlf>
{<Header>: <Value><crlf>}*
<crlf>
Example
HTTP/1.0 200 OK
Server: MDMA/0.1
MIME-version: 1.0
Content-type: text/html
Last-Modified: Thu Jul 7 00:25:33 1994
Content-Length: 2003
HTTP Illustrated
The problems with HTTP can best be understood by looking at the network traffic
generated by a typical HTTP transaction. This example was generated by using Van
Jacobsen's tcpdump program to monitor a client at UNC fetching a copy of the NCSA
Home page. This page is 1668 bytes long, including response headers. The client at UNC
was a Sun Sparcstation 20/512, running Solaris 2.3. The server at NCSA was a Hewlett
Packard 9000/735 running HP-UX.
The headers used in the request shown were captured from an xmosaic request. The
headers consisted of 42 lines totaling around 1130 bytes; of these lines, 41 were "Accept".
Stage 1: Time = 0
The trace begins with the client sending a connection request to the http port on the server
This trace is quite revealing. It seems that HTTP spends more time waiting than it does
transferring data. Before we take a look at what causes these delays, we'll calculate a
couple of metrics that will help us work out what's going on.
One important metric is the Round Trip Time (RTT). This is the time taken to sent a
packet from one end of the connection to the other and back. Look at the gap between
stages one and two, and between stages five and six, we can see that in our example, the
RTT is around 70 milliseconds.
Another important metric is the bandwidth of the connection. This is a measure of how
many bits per second our connection can carry. We can establish a lower bound on the
available bandwidth by noting how long it took to send one of the data packets.
The two data packets in stage four arrive with a gap of 3.57 ms; since each packet carries
512 bytes of data, this puts a lower limit on the available bandwidth of about 1.15 Mbps
(143,750 MBps).
Connection Establishment
TCP establishes connections via a three-way handshake. The client sends a connection
request, the server responds, and the client acknowledges the response. The client can send
data along with the acknowledgement.
Since the client must wait for the server to send its connection response, this procedure
sets a lower bound on the transaction time of two RTTs.
Future Networks
Improving available bandwidth is relatively easy. All you need to do is buy a faster
network. Reducing latency is somewhat harder- there are only two known ways to achieve
this; either change the speed of light, or move. Since placing workstations in particle
accelerators has been known to cause data loss, and since the second approach is in
general contrary to the philosphy of distributed systems, latency is increasingly becoming
the dominant factor in protocol performance.
Other Problems
One scalability problem caused by the single request per connection paradigm occurs due
to TCP's TIME_WAIT state. When a server closes a TCP, connection, it is required to
keep information about that connection for a period of time, in case a delayed packet turns
up and sabotages a new incarnation of the connection.
The recommended time to keep this information is 240 seconds. Because of this, a server
will leave some resources allocated for every single connection closed in the past four
minutes. On a busy server, this can add up to thousands of control blocks.
Summary
HTTP/1.0 interacts badly with TCP. It incurs frequent round-trip delays due to connection
establishment, performs slow start in both directions for short duration connections, and
incurs heavy latency penalties due to the mismatch of the typical access profiles with the
single request per transaction model. HTTP/1.0 also requires busy servers to dedicate
resources to maintaining TIME_WAIT information for large numbers of closed
connections.
RESULT :
Hence, various HTTP requests and problems have been Identified and Analysed
Successfully.
8. simple calculator using JavaScript
Task: Design a simple calculator using JavaScript to perform sum, product, difference,
and quotient operations.
Aim: To Design a simple calculator using JavaScript to perform sum, product,
difference, and quotient operations.
Description:
Program:
<!DOCTYPE html>
<html lang = "en">
<head>
<title> JavaScript Calculator </title>
<style>
h1 {
text-align: center;
padding: 23px;
background-color: skyblue;
color: white;
}
#clear{
width: 270px;
border: 3px solid gray;
border-radius: 3px;
padding: 20px;
background-color: red;
}
.formstyle
{
width: 300px;
height: 530px;
margin: auto;
border: 3px solid skyblue;
border-radius: 5px;
padding: 20px;
}
input
{
width: 20px;
background-color: green;
color: white;
border: 3px solid gray;
border-radius: 5px;
padding: 26px;
margin: 5px;
font-size: 15px;
}
#calc{
width: 250px;
border: 5px solid black;
border-radius: 3px;
padding: 20px;
margin: auto;
}
</style>
</head>
<body>
<h1> Calculator Program in JavaScript </h1>
<div class= "formstyle">
<form name = "form1">
<!-- This input box shows the button pressed by the user in calculator. -->
<input id = "calc" type ="text" name = "answer"> <br> <br>
<!-- Display the calculator button on the screen. -->
<!-- onclick() function display the number prsses by the user. -->
<input type = "button" value = "1" onclick = "form1.answer.value += '1' ">
<input type = "button" value = "2" onclick = "form1.answer.value += '2' ">
<input type = "button" value = "3" onclick = "form1.answer.value += '3' ">
<input type = "button" value = "+" onclick = "form1.answer.value += '+' ">
<br> <br>
<div class="image">
<imgsrc="item-1.png" alt="" />
</div>
<div class="description">
<span>Common Projects</span>
<span>Bball High</span>
<span>White</span>
</div>
<div class="quantity">
<button class="plus-btn" type="button" name="button">
<imgsrc="plus.svg" alt="" />
</button>
<input type="text" name="name" value="1">
<button class="minus-btn" type="button" name="button">
<imgsrc="minus.svg" alt="" />
</button>
</div>
<div class="total-price">$549</div>
</div>
<div class="image">
<imgsrc="item-2.png" alt=""/>
</div>
<div class="description">
<span>MaisonMargiela</span>
<span>Future Sneakers</span>
<span>White</span>
</div>
<div class="quantity">
<button class="plus-btn" type="button" name="button">
<imgsrc="plus.svg" alt="" />
</button>
<input type="text" name="name" value="1">
<button class="minus-btn" type="button" name="button">
<imgsrc="minus.svg" alt="" />
</button>
</div>
<div class="total-price">$870</div>
</div>
<div class="image">
<imgsrc="item-3.png" alt="" />
</div>
<div class="description">
<span>Our Legacy</span>
<span>Brushed Scarf</span>
<span>Brown</span>
</div>
<div class="quantity">
<button class="plus-btn" type="button" name="button">
<imgsrc="plus.svg" alt="" />
</button>
<input type="text" name="name" value="1">
<button class="minus-btn" type="button" name="button">
<imgsrc="minus.svg" alt="" />
</button>
</div>
<div class="total-price">$349</div>
</div>
</div>
<script type="text/javascript">
$('.minus-btn').on('click', function(e) {
e.preventDefault();
var $this = $(this);
var $input = $this.closest('div').find('input');
var value = parseInt($input.val());
if (value > 1) {
value = value - 1;
} else {
value = 0;
}
$input.val(value);
});
$('.plus-btn').on('click', function(e) {
e.preventDefault();
var $this = $(this);
var $input = $this.closest('div').find('input');
var value = parseInt($input.val());
$('.like-btn').on('click', function() {
$(this).toggleClass('is-active');
});
</script>
</body>
</html>
Note:
Save the above program with .html extension.
Css code:
@import url(https://fonts.googleapis.com/css?family=Roboto:300,400,500);
*{
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
padding: 10px;
margin: 0;
background-color: #7EC855;
font-family: 'Roboto', sans-serif;
}
.shopping-cart {
width: 750px;
height: 423px;
margin: 80px auto;
background: #FFFFFF;
box-shadow: 1px 2px 3px 0px rgba(0,0,0,0.10);
border-radius: 6px;
display: flex;
flex-direction: column;
}
.title {
height: 60px;
border-bottom: 1px solid #E1E8EE;
padding: 20px 30px;
color: #5E6977;
font-size: 18px;
font-weight: 400;
}
.item {
padding: 20px 30px;
height: 120px;
display: flex;
}
.item:nth-child(3) {
border-top: 1px solid #E1E8EE;
border-bottom: 1px solid #E1E8EE;
}
.delete-btn {
display: inline-block;
cursor: pointer;
width: 18px;
height: 17px;
background: url("delete-icn.svg") no-repeat center;
margin-right: 20px;
}
.like-btn {
position: absolute;
top: 9px;
left: 15px;
display: inline-block;
background: url('twitter-heart.png');
width: 60px;
height: 60px;
background-size: 2900%;
background-repeat: no-repeat;
cursor: pointer;
}
.is-active {
animation-name: animate;
animation-duration: .8s;
animation-iteration-count: 1;
animation-timing-function: steps(28);
animation-fill-mode: forwards;
}
@keyframes animate {
0% { background-position: left; }
50% { background-position: right; }
100% { background-position: right; }
}
/* Product Image */
.image {
margin-right: 50px;
}
/* Product Description */
.description {
padding-top: 10px;
margin-right: 60px;
width: 115px;
}
.description span {
display: block;
font-size: 14px;
color: #43484D;
font-weight: 400;
}
.description span:first-child {
margin-bottom: 5px;
}
.description span:last-child {
font-weight: 300;
margin-top: 8px;
color: #86939E;
}
/* Product Quantity */
.quantity {
padding-top: 20px;
margin-right: 60px;
}
.quantity input {
-webkit-appearance: none;
border: none;
text-align: center;
width: 32px;
font-size: 16px;
color: #43484D;
font-weight: 300;
}
button[class*=btn] {
width: 30px;
height: 30px;
background-color: #E1E8EE;
border-radius: 6px;
border: none;
cursor: pointer;
}
.minus-btnimg {
margin-bottom: 3px;
}
.plus-btnimg {
margin-top: 2px;
}
button:focus,
input:focus {
outline:0;
}
/* Total Price */
.total-price {
width: 83px;
padding-top: 27px;
text-align: center;
font-size: 16px;
color: #43484D;
font-weight: 300;
}
/* Responsive */
@media (max-width: 800px) {
.shopping-cart {
width: 100%;
height: auto;
overflow: hidden;
}
.item {
height: auto;
flex-wrap: wrap;
justify-content: center;
}
.image img {
width: 50%;
}
.image,
.quantity,
.description {
width: 100%;
text-align: center;
margin: 6px 0;
}
.buttons {
margin-right: 20px;
}
}
Note:
Save the above code with style.css .
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->
<title>Icon</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Ecommerce" transform="translate(-180.000000, -5886.000000)"
fill="#BDC7CF">
<g id="Cart-#1-Copy" transform="translate(150.000000, 5772.000000)">
<g id="#1" transform="translate(30.000000, 81.000000)">
<pathd="M12.3880257,33.3338025L7.45682327,38.2650049,
C7.25459731,38.46671236.92792459,38.4667123,6.72621715,38.2650049
L1.61249282,33.1512806C1.41078538,32.9495731,1.08359414,32.94957310.881886702,
33.1512806L0.151280579,33.8818867C-0.0504268598,34.0835941-
0.0504268598,34.41026690.151280579,34.6124928L5.26500491,39.7262172
C5.46671235,39.92792465.46671235,40.25459735.26500491,40.4568233
L0.333802478,45.3875072C0.132095039,45.58921460.132095039,45.9164059
0.333802478,46.1181133L1.0644086,46.8487194C1.26611604,47.0504269
1.59330728,47.05042691.79501472,46.8487194L6.72621715,41.917517
C6.92792459,41.71580967.25459731,41.71580967.45682327,41.917517
L12.2049853,46.6661975C12.4066927,46.86790512.733884,46.867905
12.9355914,46.6661975L13.6661975,45.9355914C13.867905,45.733884
13.867905,45.406692713.6661975,45.2049853L8.91751699,40.4568233
C8.71580955,40.25459738.71580955,39.92792468.91751699,39.7262172
L13.8487194,34.7950147C14.0504269,34.593307314.0504269,34.266116
13.8487194,34.0644086L13.1181133,33.3338025C12.9164059,33.132095
12.5897331,33.132095 12.3880257,33.3338025" id="Icon">
</path>
</g>
</g>
</g>
</g>
</svg>
Note:Save the above code with delete-icn.svg.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="10px" height="2px" viewBox="0 0 10 2" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->
<title>Icon</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Ecommerce" transform="translate(-722.000000, -5892.000000)" fill="#86939E">
<g id="Cart-#1-Copy" transform="translate(150.000000, 5772.000000)">
<g id="#1" transform="translate(30.000000, 81.000000)">
<g id="QTY" transform="translate(459.000000, 25.000000)">
<rect id="Icon" x="83" y="14" width="10" height="2"></rect>
</g>
</g>
</g>
</g>
</g>
</svg>
Note:
Save the above code with minus.svg.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="10px" height="10px" viewBox="0 0 10 10" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->
<title>Icon</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Ecommerce" transform="translate(-649.000000, -5888.000000)" fill="#86939E">
<g id="Cart-#1-Copy" transform="translate(150.000000, 5772.000000)">
<g id="#1" transform="translate(30.000000, 81.000000)">
<g id="QTY" transform="translate(459.000000, 25.000000)">
<path d="M14,14 L10,14 L10,16 L14,16 L14,20 L16,20 L16,16 L20,16 L20,14 L16,14
L16,10 L14,10 L14,14 Z" id="Icon"></path>
</g>
</g>
</g>
</g>
</g>
</svg>
Note:
Save the above code withplus.svg.
Output:
Result:
Hence , the Shopping Cart Application by using Dynamic HTML with JavaScript have
been designed and developed successfully.
10.Hostel Application Form using JQuery
Task: Validate all Fields and Submit the Hostel Application Form designed in Module-6
using Jquery.
Aim:To Validate all Fields and Submit the Hostel Application Form designed in Module-6
using Jquery.
Description:
JQuery form Validation
The jQuery provide several plugins for validating a diffrent types of form data on client
side. In this form validation , we have simple and basic form validation using jQuery
validator() method.
we need to put the jQuery library cdn plugin in form. In otherwords, To use jQuery
Validation Plugin we need to include cdn library of jQuery validation plugin.
<scriptsrc="https://code.jquery.com/jquery-
3.1.1.min.js"></script><scriptsrc="https://cdnjs.cloudflare.com/a
jax/libs/jqueryvalidate/1.19.0/jquery.validate.js"></script>
validation rules
Next, we need to write some validation rules in script tag. Below we have written this
basic rules for validating a form data before send to the server. The validate() method is
used to validate a form based on the selector provided.
Program:
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hostel Registration form </title>
<style>
@import
url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@600&display=swap');
:root{
--success-color:#2ecc71;
--error-color: #e74c3c;
}
*{
box-sizing: border-box;
}
body{
background-color: #f9fafb;
font-family:'OpenSans',sans-serif;
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
margin: 0;
}
.container{
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 10px rgba(0,0,0, 0.3);
width: 400px;
}
h2{
text-align: center;
margin: 0 0 20px;
}
.form{
padding: 30px 40px;
}
.form-control{
margin-bottom: 10px;
padding-bottom: 20px;
position: relative;
}
.form-control label{
color: #777;
display: block;
margin-bottom: 5px;
}
.form-control input{
border: 2px solid #f0f0f0;
border-radius: 4px;
width: 100%;
padding: 10px;
font-size: 14px;
}
.form-control input:focus{
outline: 0;
border-color: #777;
}
.form-control.success input
{
border-color:var(--success-color);
}
.form-control.error input{
border-color:var(--error-color);
}
.form-control small{
color: var(--error-color);
position: absolute;
bottom: 0;
left: 0;
visibility: hidden;
}
.form-control.error small{
visibility: visible;
}
.form button{
cursor: pointer;
background-color: #3498db;
border: 2px sold #3498db;
border-radius: 4px;
color: #fff;
display: block;
font-size: 16px;
padding: 10px;
margin-top: 10px;
width: 100%;
}
</style>
</head>
<body>
<div class="container">
<form id="form" class="form" autocomplete="off">
<h2>Hostel Register Form</h2>
<div class="form-control">
<label for="username">Username</label>
<input type="text" id="username" placeholder="Enter username">
<small>Error message</small>
</div>
<div class="form-control">
<label for="email">Email</label>
<input type="text" id="email" placeholder="Enter email">
<small>Error message</small>
</div>
<div class="form-control">
<label for="password">Password</label>
<input type="password" id="password" placeholder="Enter password">
<small>Error message</small>
</div>
<div class="form-control">
<label for="password2">Confirm Passsword</label>
<input type="password" id="password2" placeholder="Enter password again">
<small>Error message</small>
</div>
<button type="submit">Submit</button>
</form>
</div>
<script>
const form=document.getElementById('form');
const username=document.getElementById('username');
const email=document.getElementById('email');
const password=document.getElementById('password');
const password2=document.getElementById('password2');
//Show input error message
function showError(input,message){
constformControl=input.parentElement;
formControl.className='form-control error';
const small=formControl.querySelector('small');
small.innerText=message;
}
function showSuccess(input){
constformControl=input.parentElement;
formControl.className='form-control success';
}
//Email
function isValidEmail(email)
{
const re= /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-
9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
form.addEventListener('submit',function(e){
e.preventDefault();
if(username.value===''){
showError(username,'Username is required');
}
else{
showSuccess(username);
}
if(email.value===''){
showError(email,'Email is required');
}else if(!isValidEmail(email.value)){
showError(email,'Email is not valid');
}
else{
showSuccess(email);
}
if(password.value===''){
showError(password,'Password is required');
}
else{
showSuccess(password);
}
if(password2.value===''){
showError(password2,'confirm password is required');
}
else{
showSuccess(password2);
}
});
</script>
</body>
</html>
Output:
Result:
Hence , all the fields in Hostel Application Form designed in Module-6 have
been validated and submitted successfully by using Jquery.
Google Charts
Task: Develop an HTML document to illustrate each chart with real-time examples.
Aim:To Develop an HTML document to illustrate each chart with real-time examples.
Description:
Program for Pie Chart:
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 11],
['Eat', 2],
['Commute', 2],
['Watch TV', 2],
['Sleep', 7]
]);
var options = {
title: 'My Daily Activities'
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="piechart" style="width: 900px; height: 500px;"></div>
</body>
</html>
Output:
Program for Bar Chart:
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['bar']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses', 'Profit'],
['2017', 1000, 400, 200],
['2018', 1170, 460, 250],
['2019', 660, 1120, 300],
['2020', 1030, 540, 350]
]);
var options = {
chart: {
title: 'Company Performance',
subtitle: 'Sales, Expenses, and Profit: 2017-2020',
},
bars: 'horizontal' // Required for Material Bar Charts.
};
var chart = new google.charts.Bar(document.getElementById('barchart_material'));
chart.draw(data, google.charts.Bar.convertOptions(options));
}
</script>
</head>
<body>
<div id="barchart_material" style="width: 900px; height: 500px;"></div>
</body>
</html>
Program for Area Chart:
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2013', 1000, 400],
['2014', 1170, 460],
['2015', 660, 1120],
['2016', 1030, 540]
]);
var options = {
title: 'Company Performance',
hAxis: {title: 'Year', titleTextStyle: {color: '#333'}},
vAxis: {minValue: 0}
};
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
Program for Histogram:
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load("current", {packages:["corechart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Quarks', 'Leptons', 'Gauge Bosons', 'Scalar Bosons'],
[2/3, -1, 0, 0],
[2/3, -1, 0, null],
[2/3, -1, 0, null],
[-1/3, 0, 1, null],
[-1/3, 0, -1, null],
[-1/3, 0, null, null],
[-1/3, 0, null, null]
]);
var options = {
title: 'Charges of subatomic particles',
legend: { position: 'top', maxLines: 2 },
colors: ['#5C3292', '#1A8763', '#871B47', '#999999'],
interpolateNulls: false,
};
var chart = new google.visualization.Histogram(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
Program for Line Charts:
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
var options = {
title: 'Company Performance',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
</body>
</html>
Output:
Program for Gantt Chart:
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['gantt']});
google.charts.setOnLoadCallback(drawChart);
function daysToMilliseconds(days) {
return days * 24 * 60 * 60 * 1000;
}
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Task ID');
data.addColumn('string', 'Task Name');
data.addColumn('string', 'Resource');
data.addColumn('date', 'Start Date');
data.addColumn('date', 'End Date');
data.addColumn('number', 'Duration');
data.addColumn('number', 'Percent Complete');
data.addColumn('string', 'Dependencies');
data.addRows([
['Research', 'Find sources', null,
new Date(2015, 0, 1), new Date(2015, 0, 5), null, 100, null],
['Write', 'Write paper', 'write',
null, new Date(2015, 0, 9), daysToMilliseconds(3), 25, 'Research,Outline'],
['Cite', 'Create bibliography', 'write',
null, new Date(2015, 0, 7), daysToMilliseconds(1), 20, 'Research'],
['Complete', 'Hand in paper', 'complete',
null, new Date(2015, 0, 10), daysToMilliseconds(1), 0, 'Cite,Write'],
['Outline', 'Outline paper', 'write',
null, new Date(2015, 0, 6), daysToMilliseconds(1), 100, 'Research']
]);
var options = {
height: 275
};
var chart = new google.visualization.Gantt(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>
Output:
Result:
E-learning website using any CMS
Task: Develop an E-learning website using any CMS(for example WordPress)
Aim: To Develop an E-learning website using any CMS.
Description:
Program: