Skip to content

Commit

Permalink
add solar+wind metric
Browse files Browse the repository at this point in the history
  • Loading branch information
chienleng committed May 23, 2024
1 parent 37e0791 commit 46ff71c
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/Charts/OpenChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
:convert-value="convertValue"
:pad-y-axis="padYAxis"
:annotations="annotations"
:path-stroke-width="3"
:path-stroke-width="2"
class="vis-chart"
@date-hover="handleDateHover"
@domain-hover="handleDomainHover"
Expand Down
30 changes: 22 additions & 8 deletions components/MetricsSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
Carbon intensity
</option>

<optgroup label="Generation">
<optgroup
label="Generation"
v-if="isCompareView">
<option value="renewables">Renewables generation</option>
<option value="solarWind">Solar + Wind generation</option>
<option value="solar">Solar generation</option>
<option value="wind">Wind generation</option>
<option value="gas">Gas generation</option>
Expand All @@ -22,6 +25,9 @@
<option value="renewablesProportion">
Renewables proportion
</option>
<option value="solarWindProportion">
Solar + Wind proportion
</option>
<option value="solarProportion">
Solar proportion
</option>
Expand Down Expand Up @@ -52,17 +58,25 @@
</template>

<script>
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters({
currentView: 'currentView',
}),
selectedMetric: {
get() {
return this.$store.getters['stripes/selectedMetric']
},
get() {
return this.$store.getters['stripes/selectedMetric']
},
set(val) {
this.$store.commit('stripes/selectedMetric', val)
}
},
set(val) {
this.$store.commit('stripes/selectedMetric', val)
}
},
isCompareView() {
return this.currentView === 'compare'
},
}
}
</script>
2 changes: 1 addition & 1 deletion constants/energy-regions.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const EnergyRegions = [
id: ENERGY_SA,
abbr: 'SA',
label: 'South Australia',
colour: '#F8D35B',
colour: '#f7c41d',
timezoneString: 'AEST',
parentRegion: ENERGY_NEM
},
Expand Down
20 changes: 20 additions & 0 deletions constants/stripes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ export const metrics = [
numberFormatString: ',.0f',
legendType: 'ramp'
},
{
label: 'Solar + Wind proportion (of demand)',
value: 'solarWindProportion',
divisor: 100,
domain: [0, 0.5, 1],
range: ['#fff', '#52BCA3', 'darkgreen'],
unit: '%',
numberFormatString: ',.0f',
legendType: 'ramp'
},
{
label: 'Wind proportion (of demand)',
value: 'windProportion',
Expand Down Expand Up @@ -123,6 +133,16 @@ export const metrics = [
numberFormatString: '',
legendType: 'ramp'
},
{
label: 'Solar + Wind generation',
value: 'solarWind',
divisor: 100,
domain: [0, 0.5, 1],
range: ['#fff', '#52BCA3', 'darkgreen'],
unit: 'GWh',
numberFormatString: '',
legendType: 'ramp'
},
{
label: 'Solar generation',
value: 'solar',
Expand Down
2 changes: 2 additions & 0 deletions data/transform/energy-to-stripe-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ function updateMetricObject(
d._totalDemandWindProportion < 0 ? 0 : d._totalDemandWindProportion
obj.solarProportion =
d._totalDemandSolarProportion < 0 ? 0 : d._totalDemandSolarProportion
obj.solarWindProportion = obj.windProportion + obj.solarProportion
obj.coalProportion =
d._totalDemandCoalProportion < 0 ? 0 : d._totalDemandCoalProportion
obj.coal = d._totalCoal
Expand All @@ -231,6 +232,7 @@ function updateMetricObject(
obj.gas = d._totalGas
obj.wind = d._totalWind
obj.solar = d._totalSolar
obj.solarWind = d._totalSolar + d._totalWind
obj.renewables = d._totalRenewables
obj.coal = d._totalCoal

Expand Down
16 changes: 15 additions & 1 deletion pages/compare/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,18 @@ export default {
metric: val
}
})
this.doUpdateXTicks({
range: this.range,
interval: this.interval,
isZoomed: this.zoomExtent.length > 0,
filterPeriod: this.filterPeriod
})
this.doUpdateTickFormats({
range: this.range,
interval: this.interval,
filterPeriod: this.filterPeriod
})
},
rangeIntervalsQuery(val) {
Expand Down Expand Up @@ -338,7 +350,9 @@ export default {
doGetAllMonthlyData: 'regionEnergy/doGetAllMonthlyData',
doUpdateAllRegionDatasetByInterval: 'regionEnergy/doUpdateAllRegionDatasetByInterval',
doUpdateTickFormats: 'visInteract/doUpdateTickFormats',
doUpdateXGuides: 'visInteract/doUpdateXGuides'
doUpdateXGuides: 'visInteract/doUpdateXGuides',
doUpdateXTicks: 'visInteract/doUpdateXTicks',
doUpdateTickFormats: 'visInteract/doUpdateTickFormats'
}),
...mapMutations({
setHighlightDomain: 'visInteract/highlightDomain',
Expand Down

0 comments on commit 46ff71c

Please sign in to comment.