Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions webapp/components/Viz/MonthlyFlow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,18 @@ const buildChart = () => {
return historicalFlowData[monthKey]
})

let projectedFlowData
if (appContext.value === 'mid') {
projectedFlowData = []
Object.keys(monthLabels).forEach(monthKey => {
projectedFlowData.push(
props.streamMonthlyFlow['projected'][appContext.value][monthKey]
)
})
} else {
projectedFlowData = props.streamMonthlyFlow['projected'][appContext.value]
}
const projectedFlowDataMid: number[] =
appContext.value === 'mid'
? Object.keys(monthLabels).map(
monthKey =>
props.streamMonthlyFlow['projected'][appContext.value][monthKey]
)
: []

const projectedFlowDataExtremes: Record<string, number[]> =
appContext.value === 'extremes'
? props.streamMonthlyFlow['projected'][appContext.value]
: {}

// For "extremes" mode, show a boxplot populated by all values across all models
// and scenarios for each month. For "mid" mode, show a single point of the mean
Expand All @@ -83,10 +84,10 @@ const buildChart = () => {
let showLegend = true
Object.keys(monthLabels).forEach(monthKey => {
traces.push({
x: Array(projectedFlowData[monthKey].length).fill(
x: Array(projectedFlowDataExtremes[monthKey].length).fill(
monthLabels[monthKey]
),
y: projectedFlowData[monthKey],
y: projectedFlowDataExtremes[monthKey],
type: 'box',
name: 'Projected (Modeled), 2046-2075',
marker: { color: '#3182bd', size: 8 },
Expand All @@ -99,7 +100,7 @@ const buildChart = () => {
} else {
traces.push({
x: Object.values(monthLabels),
y: projectedFlowData,
y: projectedFlowDataMid,
type: 'scatter',
mode: 'markers',
name: 'Projected (Modeled), 2046-2075',
Expand Down