-
Notifications
You must be signed in to change notification settings - Fork 0
/
PUL-practice
90 lines (67 loc) · 2.82 KB
/
PUL-practice
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html>
<head>
<title> Form and data presentation </title>
<style>
html, body, #container {
width: 100%;
height: 100%;
margin: 15px;
padding: 0;
}
</style>
</head>
<body>
<fieldset>
<legend> Order your food!</legend>
<form action="index.html" method="post">
<label for="color">Dessert:</label>
<select id="color" name="shirt_color">
<option value="tres leches"> Tres Leches </option>
<option value="cheesecake">Cheesecake</option>
<option value="ice cream">Ice Cream</option>
<option value="fruit dessert">Fruit Dessert</option>
<option value="coconut candy">Coconut Candy</option>
</select>
<br> <br>
<input type="radio" id="small" value="small" name="shirt_size"><label for="small">Small</label><br>
<input type="radio" id="medium" value="medium" name="shirt_size"><label for="medium">Medium</label><br>
<input type="radio" id="large" value="large" name="shirt_size"><label for="large">Large</label><br>
<br>
<button type="submit">Place Order</button>
</form>
</fieldset>
<script src="https://cdn.anychart.com/releases/8.0.1/js/anychart-core.min.js"></script>
<script src="https://cdn.anychart.com/releases/8.0.1/js/anychart-pie.min.js"></script>
<div id="container" style="width: 100%; height: 100%">
<script>
// sources:
// https://www.anychart.com/blog/2017/12/06/pie-chart-create-javascript/
// https://www.anychart.com/products/anychart/gallery/Pie_and_Donut_Charts/
anychart.onDocumentReady(function() {
// set the data
var data = [
{x: "Tres Leches", value: 40},
{x: "Cheesecake", value: 20},
{x: "Ice Cream", value: 25},
{x: "Fruit desserts", value: 10},
{x: "Coconut candy", value: 5},
];
// create the chart
var chart = anychart.pie();
// set the chart title
chart.title("My favorite foods and desserts by preference");
// add the data
chart.data(data);
// display the chart in the container
chart.container('container');
chart.draw();
// set legend position
chart.legend().position("right");
// set items layout
chart.legend().itemsLayout("vertical");
});
</script>
</div>
</body>
</html>