-
Notifications
You must be signed in to change notification settings - Fork 0
/
ingredients-top4-d3-radar.html
128 lines (121 loc) · 4.08 KB
/
ingredients-top4-d3-radar.html
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<html lang="en">
<head>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-063933E3C2"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-063933E3C2");
</script>
<title>Madeleinology: Madeleine shapes</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" type="image/png" href="favicon.png" />
<script src="data/recipes-data.js" type="text/javascript"></script>
<script src="https://d3js.org/d3.v3.js"></script>
<script src="js/radar-chart.js"></script>
<link href="css/madeleinology.css" rel="stylesheet" />
<link rel="stylesheet" href="css/radar-chart.css" />
<meta
name="keywords"
content="d3, d3js, radar, spider, chart, graph, madeleine, cake, ingredients, egg, sugar, flour, butter"
/>
<meta
name="description"
content="Madeleinology: Radar charts for the proportions of flour, sugar, butter, and eggs in 147 madeleine cake recipes."
/>
</head>
<body>
<ul class="pnav">
<li class="idx">
<a href="index.html"
><img class="logo" src="m-icon.png" /><span class="mq-no-sl"
>Madeleinology</span
></a
>
</li>
<li><a href="madeleines-data-science.html">Data</a></li>
<li class="num"><a href="ingredients-long-tail.html">1</a></li>
<li class="num"><a href="ingredients-top4.html ">2</a></li>
<li class="num sel"><a href="ingredients-top4-d3-radar.html">3</a></li>
<li class="num">
<a href="madeleine-cupcake-muffin-popularity.html">4</a>
</li>
<li class="num"><a href="madeleine-correlation.html">5</a></li>
<li><a href="madeleines-recipe.html">Recipe</a></li>
<li class="rnd-top"><a href="madeleines-sweet.html">Sweet</a></li>
<li class="rnd-top"><a href="madeleines-salty.html">Salty</a></li>
</ul>
<section>
<h1>Madeleine shapes</h1>
<p>
Beside the soft shapes of madeleine cakes, are the hard shapes of
ingredient quantities in radar charts.
</p>
<p>Axes: top = flour, right = egg, bottom = butter, left = sugar</p>
<div id="radar_charts"></div>
<p>
Even though each recipe has a unique shape, there is no isomorphism
between the soft shape of the cake and the hard shape of the numbers. Am
I over-analysing things again here? Will this help me find the recipe
for the perfect madeleine cakes ?
</p>
</section>
<script>
RadarChart.defaultConfig.color = function () {};
RadarChart.defaultConfig.radius = 3;
RadarChart.defaultConfig.w = 400;
RadarChart.defaultConfig.h = 400;
var recipeList = recipes.map((d) => [
{
className: "argentina",
title: d.title,
url: d.url,
axes: ["farine", "sucre", "beurre", "oeuf"].map((axis) => ({
axis: axis,
value: d["pc_" + axis],
})),
},
]);
var chart = RadarChart.chart();
var cfg = chart.config();
var content = d3.select("#radar_charts").attr("class", "h-radars");
chart.config({
w: cfg.w / 4,
h: cfg.h / 4,
axisText: false,
levels: 0,
circles: false,
});
var divs = content.selectAll("div").data(recipeList);
divs
.enter()
.append("div")
.append("svg")
.attr("height", 120)
.attr("width", 120)
.append("g")
.classed("game", 1);
divs
.append("div")
.append("a")
.attr("target", "_new")
.attr("href", function (d) {
return d[0].url;
})
.html((d) => d[0].title);
content.selectAll(".game").call(chart);
</script>
<div class="copy">
© 2024
<a href="https://evoluteur.github.io/">Olivier Giulieri</a>.
</div>
</body>
</html>