Skip to content

Commit 1d63873

Browse files
committed
support both v5 and v6 charts.
1 parent 8b31e74 commit 1d63873

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2209,7 +2209,8 @@
22092209
"displayName": "Deepnote Vega Chart Renderer",
22102210
"entrypoint": "./dist/webviews/webview-side/vegaRenderer/vegaRenderer.js",
22112211
"mimeTypes": [
2212-
"application/vnd.vega.v6+json"
2212+
"application/vnd.vega.v6+json",
2213+
"application/vnd.vega.v5+json"
22132214
],
22142215
"requiresMessaging": "optional"
22152216
},

src/notebooks/deepnote/deepnoteDataConverter.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ export class DeepnoteDataConverter {
250250
data['application/vnd.deepnote.dataframe.v3+json'] = JSON.parse(
251251
new TextDecoder().decode(item.data)
252252
);
253+
} else if (item.mime === 'application/vnd.vega.v6+json') {
254+
data['application/vnd.vega.v6+json'] = JSON.parse(new TextDecoder().decode(item.data));
253255
} else if (item.mime === 'application/vnd.vega.v5+json') {
254256
data['application/vnd.vega.v5+json'] = JSON.parse(new TextDecoder().decode(item.data));
255257
} else if (item.mime === 'application/vnd.plotly.v1+json') {
@@ -335,7 +337,14 @@ export class DeepnoteDataConverter {
335337
);
336338
}
337339

338-
if (data['application/vnd.vega.v5+json']) {
340+
if (data['application/vnd.vega.v6+json']) {
341+
items.push(
342+
NotebookCellOutputItem.json(
343+
data['application/vnd.vega.v6+json'],
344+
'application/vnd.vega.v6+json'
345+
)
346+
);
347+
} else if (data['application/vnd.vega.v5+json']) {
339348
items.push(
340349
NotebookCellOutputItem.json(
341350
data['application/vnd.vega.v5+json'],
@@ -387,7 +396,7 @@ export class DeepnoteDataConverter {
387396
});
388397

389398
const vegaSpec = convertVegaLiteSpecToVega(patchedVegaLiteSpec as VegaLiteSpec).spec;
390-
items.push(NotebookCellOutputItem.json(vegaSpec, 'application/vnd.vega.v5+json'));
399+
items.push(NotebookCellOutputItem.json(vegaSpec, 'application/vnd.vega.v6+json'));
391400
}
392401

393402
if (data['application/json']) {

0 commit comments

Comments
 (0)