Skip to content

Commit

Permalink
use new width and height anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Oct 10, 2023
1 parent 35e4077 commit 05fbd09
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions webview/src/plots/components/vegaLite/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,20 @@ export const fillTemplate = (
continue
}

if (['<DVC_METRIC_PLOT_HEIGHT>', '<DVC_METRIC_PLOT_WIDTH>'].includes(key)) {
specStr = specStr.replace(new RegExp(key, 'g'), 'container')
continue
}

if (
['<DVC_METRIC_COLUMN_WIDTH>', '<DVC_METRIC_ROW_HEIGHT>'].includes(key)
) {
specStr = specStr.replace(new RegExp(`"${key}"`, 'g'), '300')
continue
}

specStr = specStr.replace(new RegExp(`"${key}"`, 'g'), value)
}

const spec = JSON.parse(specStr) as { [key: string]: unknown }
spec.width = 'container'
spec.height = 'container'
return spec as VisualizationSpec
return JSON.parse(specStr) as VisualizationSpec
}

0 comments on commit 05fbd09

Please sign in to comment.