Skip to content

Commit 117ee37

Browse files
authored
fix console warning on the EIA example
1 parent c13d979 commit 117ee37

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

examples/eia/src/components/charts.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ function friendlyTypeName(d) {
1616
export function top5BalancingAuthoritiesChart(width, height, top5Demand, maxDemand) {
1717
return Plot.plot({
1818
marginTop: 8,
19-
marginLeft: 250,
19+
marginLeft: Math.min(width/2, 250),
2020
height: height - 4,
2121
width,
22+
style: "overflow: hidden;",
2223
y: {label: null, tickSize: 0},
2324
x: {label: null, grid: true, tickSize: 0, tickPadding: 2, domain: [0, maxDemand / 1000], nice: true},
2425
marks: [

examples/eia/src/components/map.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ export function balancingAuthoritiesMap({
2525
}) {
2626
return Plot.plot({
2727
width,
28-
height: width * 0.6,
28+
height: width * 0.67,
2929
color: {
3030
...color,
3131
transform: (d) => d / 100,
3232
label: "Change in demand (%) from previous hour"
3333
},
3434
projection: {
3535
type: "albers",
36+
domain: nation,
3637
insetTop: 15
3738
},
3839
r: {
@@ -122,9 +123,10 @@ export function balancingAuthoritiesMap({
122123
export function balancingAuthoritiesLegend(width) {
123124
return Plot.plot({
124125
marginTop: 15,
125-
width: Math.min(width - 30, 400),
126+
marginRight: 80,
127+
width,
126128
height: 60,
127-
y: {axis: null},
129+
y: {axis: null, domain: [0, 1]},
128130
marks: [
129131
Plot.raster({
130132
y1: 0,
@@ -136,14 +138,16 @@ export function balancingAuthoritiesLegend(width) {
136138
Plot.ruleX([-0.15, 0, 0.15], {insetBottom: -5}),
137139
Plot.axisX([-0.15, 0, 0.15], {tickFormat: format("+.0%"), tickSize: 0}),
138140
Plot.dot(["Generating only", "Unavailable"], {
139-
x: [0.23, 0.4],
141+
x: [0.26, 0.26],
142+
y: [0.75, -.25],
140143
r: 5,
141144
dx: -8,
142145
fill: [colorGenerating, colorUnavailable],
143146
stroke: "grey"
144147
}),
145148
Plot.text(["Generating only", "Unavailable"], {
146-
x: [0.23, 0.4],
149+
x: [0.26, 0.26],
150+
y: [0.75, -.25],
147151
textAnchor: "start"
148152
})
149153
]

examples/eia/src/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
theme: dashboard
3+
toc: false
34
---
45

56
# U.S. electricity grid
@@ -170,7 +171,7 @@ function centerResize(render) {
170171
<h2>US electricity generation demand vs. day-ahead forecast (GWh)</h2>
171172
${resize((width, height) => usGenDemandForecastChart(width, height, usDemandGenForecast, currentHour))}
172173
</div>
173-
<div class="card grid-colspan-2">
174+
<div class="card grid-colspan-2" style="min-height: 160px;">
174175
<h2>Neighboring country interchange (GWh)</h2>
175176
${resize((width, height) => countryInterchangeChart(width, height, usDemandGenForecast, countryInterchangeSeries, currentHour))}
176177
</div>

0 commit comments

Comments
 (0)