Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use 0 instead of null values to avoid breaking the plots #94

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/components/workflows/timeline/MetricAverageChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ function init() {
function getTimelineData(runs: EvaluationRun[], metric: string): TimelineChartDataPoint[] {
const datesValues = runs.reduce((acc, cur) => {
const date = new Date(new Date(cur.metadata.timestamp).setHours(0, 0, 0, 0)).toDateString()
const value = cur.evaluation_results.document_wide[<keyof EvaluationResultsDocumentWide>metric]
if (!value || Array.isArray(value)) return acc
const value = (cur.evaluation_results.document_wide[metric as keyof EvaluationResultsDocumentWide]) ?? 0
if (Array.isArray(value)) return acc

if (!acc[date]) acc[date] = [value]
if (!acc.hasOwnProperty(date)) acc[date] = [value]
else acc[date] = [...acc[date], value]
return acc
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/workflows/timeline/MetricChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function getTimelineData(runs: EvaluationRun[], metric: keyof EvaluationResultsD
const value = evaluation_results.document_wide[metric]
return {
date: new Date(metadata.timestamp),
value
value: value ?? 0
}
})
}
Expand Down
Loading