Skip to content

Commit

Permalink
Add compare ft generation
Browse files Browse the repository at this point in the history
  • Loading branch information
chienleng committed May 8, 2024
1 parent 84bad40 commit 37e0791
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 3 deletions.
1 change: 1 addition & 0 deletions components/Charts/OpenChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
:convert-value="convertValue"
:pad-y-axis="padYAxis"
:annotations="annotations"
:path-stroke-width="3"
class="vis-chart"
@date-hover="handleDateHover"
@domain-hover="handleDomainHover"
Expand Down
8 changes: 8 additions & 0 deletions components/MetricsSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
value="carbonIntensity">
Carbon intensity
</option>

<optgroup label="Generation">
<option value="renewables">Renewables generation</option>
<option value="solar">Solar generation</option>
<option value="wind">Wind generation</option>
<option value="gas">Gas generation</option>
<option value="coal">Coal generation</option>
</optgroup>

<optgroup label="Proportion of demand">
<option value="netInterconnectorFlow">
Expand Down
6 changes: 3 additions & 3 deletions components/Vis/MultiLine.vue
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ export default {
.style('opacity', 0.9)
.style('stroke-width', (d) => {
const find = this.domains1.find((domain) => domain.id === d)
return find ? find.pathStrokeWidth : this.pathStrokeWidth
return find && find.pathStrokeWidth ? find.pathStrokeWidth : this.pathStrokeWidth
})
this.$projectionVisGroup
Expand Down Expand Up @@ -803,7 +803,7 @@ export default {
.style('stroke', (key) => this.colours1[key])
.style('stroke-width', (d) => {
const find = this.domains1.find((domain) => domain.id === d)
return find ? find.pathStrokeWidth : this.pathStrokeWidth
return find && find.pathStrokeWidth ? find.pathStrokeWidth : this.pathStrokeWidth
})
// .style('filter', 'url(#shadow)')
.style('stroke-dasharray', this.strokeDasharray)
Expand Down Expand Up @@ -863,7 +863,7 @@ export default {
.style('stroke', (key) => this.colours1[key])
.style('stroke-width', (d) => {
const find = this.domains1.find((domain) => domain.id === d)
return find ? find.pathStrokeWidth : this.pathStrokeWidth
return find && find.pathStrokeWidth ? find.pathStrokeWidth : this.pathStrokeWidth
})
// .style('filter', 'url(#shadow)')
.style('fill', 'transparent')
Expand Down
51 changes: 51 additions & 0 deletions constants/stripes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,57 @@ export const metrics = [
legendType: 'ramp'
},

{
label: 'Renewables generation',
value: 'renewables',
divisor: 100,
domain: [0, 0.5, 1],
range: ['#fff', '#52BCA3', 'darkgreen'],
unit: 'GWh',
numberFormatString: '',
legendType: 'ramp'
},
{
label: 'Solar generation',
value: 'solar',
divisor: 100,
domain: [0, 0.5, 1],
range: ['#fff', '#F3E13E', '#F0D800'],
unit: 'GWh',
numberFormatString: '',
legendType: 'ramp'
},
{
label: 'Wind generation',
value: 'wind',
divisor: 100,
domain: [0, 0.5, 1],
range: ['#fff', '#88B653', '#417505'],
unit: 'GWh',
numberFormatString: '',
legendType: 'ramp'
},
{
label: 'Gas generation',
value: 'gas',
divisor: 100,
domain: [0, 0.5, 1],
range: ['#52BCA3', '#ccc', '#F48E1B'],
unit: 'GWh',
numberFormatString: '',
legendType: 'ramp'
},
{
label: 'Coal generation',
value: 'coal',
divisor: 100,
domain: [0, 0.5, 1],
range: ['#52BCA3', '#ccc', '#131313'],
unit: 'GWh',
numberFormatString: '',
legendType: 'ramp'
},

{
label: 'Wind value',
value: 'windValue',
Expand Down
7 changes: 7 additions & 0 deletions data/transform/energy-to-stripe-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ function updateMetricObject(
}

obj.carbonIntensity = setCarbonIntensity(ei, isValidEI)

obj.renewablesProportion =
d._totalDemandRenewablesPercentage < 0
? 0
Expand All @@ -226,7 +227,13 @@ function updateMetricObject(
obj.coal = d._totalCoal
obj.gasProportion =
d._totalDemandGasProportion < 0 ? 0 : d._totalDemandGasProportion

obj.gas = d._totalGas
obj.wind = d._totalWind
obj.solar = d._totalSolar
obj.renewables = d._totalRenewables
obj.coal = d._totalCoal

obj.temperature = temperature
obj.maxTemperature = maxTemperature
obj.minTemperature = minTemperature
Expand Down

0 comments on commit 37e0791

Please sign in to comment.