@explorable-viz/fluid 0.10.4 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fluid/fluid/lib/matrix.fld +14 -18
- package/dist/fluid/fluid/lib/prelude.fld +79 -8
- package/dist/fluid/fluid/lib/stats.fld +25 -28
- package/dist/fluid/shared/fluid.mjs +3207 -2262
- package/dist/fluid/shared/load-figure.js +11059 -4058
- package/dist/fluid/shared/webtest-lib.js +29073 -29877
- package/package.json +8 -5
- package/website/article/convolution/index.html +5 -5
- package/website/article/dataset/annual-temp-anomaly.json +413 -0
- package/website/article/dataset/ccra3-risks.json +2015 -0
- package/website/article/energy-scatter/index.html +47 -0
- package/website/article/fluid/bar-chart-line-chart.fld +5 -5
- package/website/article/fluid/convolution/emboss.fld +5 -1
- package/website/article/fluid/dataset/scigen/_1805_02474v1_10.fld +1 -1
- package/website/article/fluid/energyscatter.fld +27 -0
- package/website/article/fluid/methane.fld +23 -1
- package/website/article/fluid/methane_data.fld +1 -0
- package/website/article/fluid/moving-average.fld +1 -1
- package/website/article/fluid/nonRenewables.fld +2 -2
- package/website/article/fluid/renewables.fld +1 -1
- package/website/article/methane/index.html +46 -0
- package/website/article/moving-average/index.html +2 -2
- package/website/article/non-renewables/index.html +2 -2
- package/website/article/renewables-linked/index.html +2 -2
- package/website/article/scigen-1805.02474v1-10/index.html +2 -2
- package/website/article/test.mjs +3 -1
- /package/website/article/{fluid/dataset/scigen → dataset/SciGen}/1805.02474v1-10.json +0 -0
- /package/website/article/{fluid/dataset → dataset}/methane-emissions.json +0 -0
- /package/website/article/{fluid/dataset → dataset}/non-renewables.json +0 -0
- /package/website/article/{fluid/dataset → dataset}/renewable-new.json +0 -0
- /package/website/article/{fluid/dataset → dataset}/renewable.json +0 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<link rel="icon" href="/favicon.ico" type="image/x-icon">
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
8
|
+
<title>Fluid: Data-Linked Visualisations</title>
|
9
|
+
<link href="/css/styles.css" rel="stylesheet" type="text/css">
|
10
|
+
<link href="/css/view-styles.css" rel="stylesheet" type="text/css">
|
11
|
+
<script src="https://kit.fontawesome.com/20cf8b42c0.js" crossorigin="anonymous"></script>
|
12
|
+
<script src="/shared/util.js"></script>
|
13
|
+
</head>
|
14
|
+
<body class="standalone">
|
15
|
+
<div id="grid" class="grid-container data-pane-hidden double-size">
|
16
|
+
<div></div>
|
17
|
+
<div></div>
|
18
|
+
<div>
|
19
|
+
<h3>Clean energy efficiency scatter plot</h3>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div id="fig-data-pane" class="flex-right-align data-pane">
|
23
|
+
<div id="fig-input" class="data-pane-column"></div>
|
24
|
+
</div>
|
25
|
+
<div onclick="toggleDataPane('grid')">
|
26
|
+
<i class="data-pane-button toggle-button fa-solid fa-eye-slash"></i>
|
27
|
+
</div>
|
28
|
+
<div class="flex-left-align">
|
29
|
+
<div id="fig">
|
30
|
+
<div class="fig-loading">loading figure(s)</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<script type="module">
|
36
|
+
import { loadFigure } from "/shared/load-figure.js"
|
37
|
+
const spec = {
|
38
|
+
"fluidSrcPath": ["../fluid"],
|
39
|
+
"inputs": [ "nonRenewables", "renewables" ],
|
40
|
+
"query": false,
|
41
|
+
"linking": true
|
42
|
+
}
|
43
|
+
|
44
|
+
loadFigure(spec)("../fluid/energyscatter.fld")()
|
45
|
+
</script>
|
46
|
+
</body>
|
47
|
+
</html>
|
@@ -16,11 +16,11 @@ def series(energyType, country):
|
|
16
16
|
]
|
17
17
|
|
18
18
|
MultiView({
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
barChart: BarChart({
|
20
|
+
caption: "Total renewables output by country",
|
21
|
+
size: { width: 275, height: 185 },
|
22
|
+
stackedBars: countryData
|
23
|
+
}),
|
24
24
|
lineChart: LineChart({
|
25
25
|
tickLabels: { x: Default, y: Default },
|
26
26
|
size: { width: 330, height: 285 },
|
@@ -1,2 +1,2 @@
|
|
1
1
|
def tableData:
|
2
|
-
loadJson("dataset/
|
2
|
+
loadJson("/dataset/SciGen/1805.02474v1-10.json")
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import nonRenewables
|
2
|
+
|
3
|
+
def isCountry(name, x): name == x.country
|
4
|
+
def isYear(year, x): year == x.year
|
5
|
+
|
6
|
+
def plot(year, countries):
|
7
|
+
def rens: filter(isYear(year), renewables)
|
8
|
+
def nonRens: filter(isYear(year), nonRenewables)
|
9
|
+
|
10
|
+
def plotCountry(country):
|
11
|
+
def rens_: filter(isCountry(country), rens)
|
12
|
+
def rensOut: sum(map(lambda x: x.output, rens_))
|
13
|
+
def rensCap: sum(map(lambda x: x.capacity, rens_))
|
14
|
+
def x: head(filter(isCountry(country), nonRens))
|
15
|
+
def nonRensCap: (x.nuclearCap + x.petrolCap + x.gasCap) + x.coalCap
|
16
|
+
{
|
17
|
+
x: rensCap / (rensCap + nonRensCap),
|
18
|
+
y: (rensOut + x.nuclearOut) / (rensCap + x.nuclearCap)
|
19
|
+
}
|
20
|
+
|
21
|
+
map(plotCountry, countries)
|
22
|
+
|
23
|
+
ScatterPlot({
|
24
|
+
caption: "Clean energy efficiency vs. proportion of renewable energy capacity",
|
25
|
+
points: plot(2018, [ "BRA", "CHN", "DEU", "FRA", "EGY", "IND", "JPN", "MEX", "NGA", "USA" ]),
|
26
|
+
labels: { x: "Renewables/TotalEnergyCap", y: "Clean Capacity Factor" }
|
27
|
+
})
|
@@ -1 +1,23 @@
|
|
1
|
-
|
1
|
+
import methane_data
|
2
|
+
|
3
|
+
def series(type):
|
4
|
+
[{ x: row.year, y: row.emissions } for row in methane if row.type == type]
|
5
|
+
|
6
|
+
LineChart({
|
7
|
+
size: { width: 450, height: 285 },
|
8
|
+
tickLabels: { x: Rotated, y: Default },
|
9
|
+
caption:
|
10
|
+
"Sources of methane emissions for Africa and the Middle East (IPCC AR6)",
|
11
|
+
plots:
|
12
|
+
[LinePlot({ name: type, points: series(type) }) for type in [
|
13
|
+
"Agricultural Waste Burning",
|
14
|
+
"Agriculture",
|
15
|
+
"Energy Sector",
|
16
|
+
"Forest Burning",
|
17
|
+
"Grassland Burning",
|
18
|
+
"Industrial Sector",
|
19
|
+
"Residential Commercial Other",
|
20
|
+
"Transportation Sector",
|
21
|
+
"Waste"
|
22
|
+
]]
|
23
|
+
})
|
@@ -0,0 +1 @@
|
|
1
|
+
def methane: loadJson("/dataset/methane-emissions.json")
|
@@ -1 +1 @@
|
|
1
|
-
def renewables: loadJson("dataset/renewable-new.json")
|
1
|
+
def renewables: loadJson("/dataset/renewable-new.json")
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<link rel="icon" href="/favicon.ico" type="image/x-icon">
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
8
|
+
<title>Fluid: Data-Linked Visualisations</title>
|
9
|
+
<link href="/css/styles.css" rel="stylesheet" type="text/css">
|
10
|
+
<link href="/css/view-styles.css" rel="stylesheet" type="text/css">
|
11
|
+
<script src="https://kit.fontawesome.com/20cf8b42c0.js" crossorigin="anonymous"></script>
|
12
|
+
<script src="/shared/util.js"></script>
|
13
|
+
</head>
|
14
|
+
<body class="standalone">
|
15
|
+
<div id="grid" class="grid-container data-pane-hidden double-size">
|
16
|
+
<div></div>
|
17
|
+
<div></div>
|
18
|
+
<div class="flex-left-align">
|
19
|
+
<h3>Methane</h3>
|
20
|
+
<p>Methane emissions example</p>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div id="fig-data-pane" class="flex-right-align data-pane">
|
24
|
+
<div id="fig-input" class="data-pane-column"></div>
|
25
|
+
</div>
|
26
|
+
<div onclick="toggleDataPane('grid')">
|
27
|
+
<i class="data-pane-button toggle-button fa-solid fa-eye-slash"></i>
|
28
|
+
</div>
|
29
|
+
<div id="fig">
|
30
|
+
<div class="fig-loading">loading figure(s)</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<script type="module">
|
35
|
+
import { loadFigure } from "/shared/load-figure.js"
|
36
|
+
const spec = {
|
37
|
+
"fluidSrcPath": ["../fluid"],
|
38
|
+
"inputs": [ "methane"],
|
39
|
+
"query": false,
|
40
|
+
"linking": true
|
41
|
+
}
|
42
|
+
|
43
|
+
loadFigure(spec)("../fluid/methane.fld")()
|
44
|
+
</script>
|
45
|
+
</body>
|
46
|
+
</html>
|
@@ -50,7 +50,7 @@
|
|
50
50
|
</div>
|
51
51
|
|
52
52
|
<script type="module">
|
53
|
-
import {
|
53
|
+
import { loadFigure } from "../shared/load-figure.js"
|
54
54
|
const jsonSpec = {
|
55
55
|
"fluidSrcPath": ["../fluid"],
|
56
56
|
"inputs": ["methane"],
|
@@ -58,7 +58,7 @@
|
|
58
58
|
"linking": false
|
59
59
|
}
|
60
60
|
|
61
|
-
|
61
|
+
loadFigure(jsonSpec)("../fluid/moving-average.fld")()
|
62
62
|
</script>
|
63
63
|
</body>
|
64
64
|
</html>
|
@@ -39,14 +39,14 @@
|
|
39
39
|
</div>
|
40
40
|
|
41
41
|
<script type="module">
|
42
|
-
import {
|
42
|
+
import { loadFigure } from "../shared/load-figure.js"
|
43
43
|
const jsonSpec = {
|
44
44
|
"fluidSrcPath": ["../fluid"],
|
45
45
|
"inputs": ["nonRenewables"],
|
46
46
|
"query": false,
|
47
47
|
"linking": true
|
48
48
|
}
|
49
|
-
|
49
|
+
loadFigure(jsonSpec)("../fluid/non-renewables.fld")()
|
50
50
|
</script>
|
51
51
|
</body>
|
52
52
|
</html>
|
@@ -33,14 +33,14 @@
|
|
33
33
|
</div>
|
34
34
|
|
35
35
|
<script type="module">
|
36
|
-
import {
|
36
|
+
import { loadFigure, loadCode } from "../shared/load-figure.js"
|
37
37
|
const jsonSpec = {
|
38
38
|
"fluidSrcPath": ["../fluid"],
|
39
39
|
"inputs": ["renewables"],
|
40
40
|
"query": false,
|
41
41
|
"linking": true
|
42
42
|
}
|
43
|
-
|
43
|
+
loadFigure(jsonSpec)("../fluid/bar-chart-line-chart.fld")()
|
44
44
|
</script>
|
45
45
|
</body>
|
46
46
|
</html>
|
@@ -40,7 +40,7 @@
|
|
40
40
|
</div>
|
41
41
|
|
42
42
|
<script type="module">
|
43
|
-
import {
|
43
|
+
import { loadFigure, loadCode } from "../shared/load-figure.js"
|
44
44
|
const jsonSpec = {
|
45
45
|
"fluidSrcPath": ["../fluid"],
|
46
46
|
"inputs": [ "tableData" ],
|
@@ -48,7 +48,7 @@
|
|
48
48
|
"linking": true
|
49
49
|
}
|
50
50
|
|
51
|
-
|
51
|
+
loadFigure(jsonSpec)("../fluid/1805.02474v1-10.fld")()
|
52
52
|
</script>
|
53
53
|
</body>
|
54
54
|
</html>
|
package/website/article/test.mjs
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
import { runTests, testURL, waitFor } from "./shared/webtest-lib.js"
|
1
|
+
import { click, clickToggle, runTests, testURL, waitFor } from "./shared/webtest-lib.js"
|
2
2
|
|
3
3
|
export const main = async () => {
|
4
4
|
await runTests(testURL("convolution")([ page => waitFor("svg#fig-output")(page) ]))()
|
5
|
+
const point = "div#fig .scatterplot-point"
|
6
|
+
await runTests(testURL("methane")([ page => waitFor("#fig > svg:nth-of-type(1)")(page) ]))()
|
5
7
|
await runTests(testURL("moving-average")([ page => waitFor("svg")(page) ]))()
|
6
8
|
await runTests(testURL("non-renewables")([
|
7
9
|
page => waitFor("#fig-output > svg:nth-child(1)")(page),
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|