Skip to content

Commit

Permalink
fix: measure time series function with forecast level
Browse files Browse the repository at this point in the history
  • Loading branch information
claustres committed Aug 23, 2024
1 parent 8316ed8 commit 91b3ba0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions map/client/utils/utils.features.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ export function getFeatureStyleType (feature) {
}

// Build timeseries to be used in charts from layer definition for target feature
export function getTimeSeriesForFeature({ feature, layer, startTime, endTime, runTime, level }) {
export function getTimeSeriesForFeature({ feature, layer, startTime, endTime, runTime, level, forecastLevel }) {
const variables = _.get(layer, 'variables', [])
if (variables.length === 0) return []
const properties = _.get(feature, 'properties', {})
Expand All @@ -444,8 +444,8 @@ export function getTimeSeriesForFeature({ feature, layer, startTime, endTime, ru
const time = measure.time || measure.forecastTime
const runTime = measure.runTime
const properties = _.get(measure, 'properties', {})
// Check if we are targetting a specific level
const name = (level ? `${variable.name}-${level}` : variable.name)
// Check if we are targetting a specific variable at level (forecast model case)
const name = (forecastLevel ? `${variable.name}-${forecastLevel}` : variable.name)
let values = []
// Aggregated variable available for feature ?
if (properties[name] && Array.isArray(properties[name])) {
Expand Down Expand Up @@ -474,7 +474,7 @@ export function getTimeSeriesForFeature({ feature, layer, startTime, endTime, ru
chartjs: Object.assign({
parsing: {
xAxisKey: 'time',
yAxisKey: (level ? `${variable.name}-${level}` : variable.name)
yAxisKey: (forecastLevel ? `${variable.name}-${forecastLevel}` : variable.name)
},
cubicInterpolationMode: 'monotone',
tension: 0.4
Expand Down

0 comments on commit 91b3ba0

Please sign in to comment.