@explorable-viz/fluid 0.10.0 → 0.10.2
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/shared/load-figure.js +2 -2
- package/package.json +1 -1
- package/website/article/css/view-styles.css +4 -0
- package/website/article/fluid/bar-chart-line-chart.fld +17 -17
- package/website/article/fluid/convolution.fld +6 -7
- package/website/article/fluid/scigen.fld +4 -2
- package/website/article/renewables-linked/index.html +0 -14
- package/website/article/scigen-1805.02474v1-10/index.html +1 -1
@@ -36293,7 +36293,7 @@ function xAxis(to) {
|
|
36293
36293
|
return (ticks2) => {
|
36294
36294
|
return (parent) => {
|
36295
36295
|
return () => {
|
36296
|
-
return parent.call(axisBottom(to.x));
|
36296
|
+
return parent.call(axisBottom(to.x).ticks(ticks2.length).tickFormat((d) => d));
|
36297
36297
|
};
|
36298
36298
|
};
|
36299
36299
|
};
|
@@ -37371,7 +37371,7 @@ var barChartProps = (v) => {
|
|
37371
37371
|
scales,
|
37372
37372
|
caption_height,
|
37373
37373
|
caption_class: "title-text",
|
37374
|
-
stackedBarContext: { interior, scales, strokeWidth:
|
37374
|
+
stackedBarContext: { interior, scales, strokeWidth: 2 }
|
37375
37375
|
};
|
37376
37376
|
};
|
37377
37377
|
var viewBarChartUnit = {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@explorable-viz/fluid",
|
3
|
-
"version": "0.10.
|
3
|
+
"version": "0.10.2",
|
4
4
|
"description": "A functional programming language which integrates a bidirectional dynamic analysis, connecting outputs to data sources in a fine-grained way. Fluid is implemented in PureScript and runs in the browser.",
|
5
5
|
"main": "index.js",
|
6
6
|
"repository": {
|
@@ -3,35 +3,35 @@ import renewables
|
|
3
3
|
def totalFor(c, rows): sum([row.output for row in rows if row.country == c])
|
4
4
|
|
5
5
|
def data2015: [row for row in renewables if row.year == 2015]
|
6
|
-
|
7
6
|
def countryData: [{
|
8
7
|
x: c,
|
9
8
|
segments: [{ y: "output", z: totalFor(c, data2015) }]
|
10
9
|
} for c in ["China", "USA", "Germany"]]
|
11
10
|
|
12
|
-
def series(
|
11
|
+
def series(energyType, country):
|
13
12
|
[
|
14
13
|
{ x: row.year, y: row.output }
|
15
14
|
for year in [2013 .. 2018] for row in renewables
|
16
|
-
if row.year == year if row.energyType ==
|
15
|
+
if row.year == year if row.energyType == energyType if row.country == country
|
17
16
|
]
|
18
17
|
|
19
18
|
MultiView({
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
# barChart: BarChart({
|
20
|
+
# caption: "Total renewables output by country",
|
21
|
+
# size: { width: 275, height: 185 },
|
22
|
+
# stackedBars: countryData
|
23
|
+
# }),
|
25
24
|
lineChart: LineChart({
|
26
|
-
tickLabels: { x:
|
25
|
+
tickLabels: { x: Default, y: Default },
|
27
26
|
size: { width: 330, height: 285 },
|
28
|
-
caption: "
|
27
|
+
caption: "Renewables output of USA relative to China",
|
29
28
|
plots: [
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
LinePlot({
|
30
|
+
name: energyType,
|
31
|
+
points: zipWith(lambda p1, p2: { x: p1.x, y: p1.y / p2.y }, usa, china)
|
32
|
+
})
|
33
|
+
for energyType in ["Bio", "Hydro", "Solar", "Wind"]
|
34
|
+
for (usa, china) in [(series(energyType, "USA"), series(energyType, "China"))]
|
35
|
+
]
|
36
|
+
})
|
37
37
|
})
|
@@ -6,23 +6,22 @@ def lookup(m, n, image):
|
|
6
6
|
if m >= 1 |and| m <= m_max |and| n >= 1 |and| n <= n_max:
|
7
7
|
image!(m, n)
|
8
8
|
else: 0
|
9
|
-
|
9
|
+
# image!((m - 1 |mod| m_max) + 1, (n - 1 |mod| n_max) + 1)
|
10
10
|
|
11
11
|
def matrixSum(matr):
|
12
12
|
def (m, n): dims(matr)
|
13
13
|
foldl((+), 0, [matr!(i, j) for (i, j) in range((1, 1), (m, n))])
|
14
14
|
|
15
15
|
def convolve(image, kernel):
|
16
|
-
def (
|
17
|
-
|
18
|
-
def (half_i, half_j):
|
19
|
-
(i |quot| 2, j |quot| 2)
|
16
|
+
def (m, n): dims(image)
|
17
|
+
def (i, j): dims(kernel)
|
18
|
+
def (half_i, half_j): (i |quot| 2, j |quot| 2)
|
20
19
|
def area: i * j
|
21
20
|
|
22
21
|
def interMatrix(m_, n_):
|
23
|
-
|
22
|
+
# @doc("""average these values to compute element""")
|
24
23
|
[| kernel!(i_, j_) *
|
25
|
-
lookup(
|
24
|
+
lookup(m_ + i_ - 1 - half_i, n_ + j_ - 1 - half_j, image)
|
26
25
|
for (i_, j_) in (i, j) |]
|
27
26
|
|
28
27
|
[| matrixSum(interMatrix(m_, n_)) |quot| area for (m_, n_) in (m, n) |]
|
@@ -17,8 +17,10 @@ def ordinal(n):
|
|
17
17
|
error("n > 20 not supported")
|
18
18
|
|
19
19
|
def rankLabel(word, n):
|
20
|
-
|
21
|
-
|
20
|
+
def prefix:
|
21
|
+
if n == 1: ""
|
22
|
+
else: ordinal(n) ++ "-"
|
23
|
+
prefix ++ word
|
22
24
|
|
23
25
|
def trendWord(n1, n2, compareWord):
|
24
26
|
compareWord(compare(n1, n2))
|
@@ -17,9 +17,6 @@
|
|
17
17
|
<div></div>
|
18
18
|
<div>
|
19
19
|
<h3>Non-renewables energy output</h3>
|
20
|
-
<p>Click the grey toggle and mouse over the bars.
|
21
|
-
<br>
|
22
|
-
<b>Clicking</b> makes a selection “persistent”.</p>
|
23
20
|
</div>
|
24
21
|
|
25
22
|
<div id="fig-data-pane" class="flex-right-align data-pane">
|
@@ -32,15 +29,6 @@
|
|
32
29
|
<div id="fig">
|
33
30
|
<div class="fig-loading">loading figure(s)</div>
|
34
31
|
</div>
|
35
|
-
<p>Source code:</p>
|
36
|
-
<details>
|
37
|
-
<summary>bar-chart-line-chart.fld</summary>
|
38
|
-
<div id="codemirror-bar-chart-line-chart"></div>
|
39
|
-
</details>
|
40
|
-
<details>
|
41
|
-
<summary>renewables.fld</summary>
|
42
|
-
<div id="codemirror-renewables"></div>
|
43
|
-
</details>
|
44
32
|
</div>
|
45
33
|
</div>
|
46
34
|
|
@@ -52,8 +40,6 @@
|
|
52
40
|
"query": false,
|
53
41
|
"linking": true
|
54
42
|
}
|
55
|
-
|
56
|
-
drawCode("../fluid/bar-chart-line-chart.fld")()
|
57
43
|
loadFigureSpec(jsonSpec)("../fluid/bar-chart-line-chart.fld")()
|
58
44
|
</script>
|
59
45
|
</body>
|