Skip to content

Commit

Permalink
test multiple time periods
Browse files Browse the repository at this point in the history
  • Loading branch information
solderq35 committed Dec 12, 2023
1 parent be73500 commit e837df0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VUE_APP_ROOT_API=http://localhost:3000
VUE_APP_ROOT_API=https://api.sustainability.oregonstate.edu/v2/energy
VUE_APP_HOST_ADDRESS=http://localhost:8080
2 changes: 2 additions & 0 deletions src/components/view/view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default {
immediate: true,
handler: async function ( buildings ) {
if ( this.$route.path.includes( 'compare' ) ) {
console.log( this.cards[0] )
if ( this.cards.length > 0 && this.cards[0] ) {
await this.$store.dispatch( this.cards[0].path + '/removeAllModifiers' )
await this.$store.dispatch( this.cards[0].path + '/addModifier', 'building_compare' )
Expand Down Expand Up @@ -116,6 +117,7 @@ export default {
for ( let card of this.cards ) {
if ( !card.path ) return
this.$nextTick( () => {
console.log( card )
this.$store.commit( card.path + '/dateStart', this.dateStart )
this.$store.commit( card.path + '/dateEnd', this.dateEnd )
this.$store.commit( card.path + '/dateInterval', this.dateInterval )
Expand Down
1 change: 1 addition & 0 deletions src/store/block.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ const actions = {
await this.getters[payload.group.path + '/meters'][0].promise
utilityType = this.getters[this.getters[payload.group.path + '/meters'][0].path + '/type']
}
// something here is important with name assign
store.commit( chartSpace + '/name', 'Total ' + utilityType )
const pointMap = {
Electricity: 'accumulated_real',
Expand Down
22 changes: 22 additions & 0 deletions src/store/chart.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,33 @@ const actions = {
...payload,
...store.getters.modifierData
}
console.log( store.getters.name )
let initdatestart = reqPayload.dateStart
if ( store.getters.name === 'Total Electricity' ) {
reqPayload.dateStart = 1700341200
}
console.log( reqPayload )

const chartModifier = ChartModifiers( payload.graphType, reqPayload.point )
await chartModifier.preGetData( reqPayload, this, store )

let data = await this.dispatch( store.getters.meterGroupPath + '/getData', reqPayload )

if ( store.getters.name === 'Total Electricity' ) {
// console.log( data )
let testmap = new Map()
for ( let newkey of data.keys() ) {
// console.log(newkey)

// align new key with original datestart
testmap.set( newkey - ( reqPayload.dateStart - initdatestart ), data.get( newkey ) )
}
console.log( testmap )

// comment out the 2 lines below to test experimental moving chart left
// data = testmap
// reqPayload.dateStart = initdatestart
}
let chartData = {
label: store.getters.name,
backgroundColor: store.getters.color,
Expand Down

0 comments on commit e837df0

Please sign in to comment.