You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the output tmp.html file does not display the Perspective view correctly due to the following issues:
viewerId is not assigned as a string.
viewerAttrs is not a properly formatted JSON object.
The call to await perspective.worker().table(data.buffer) raises TypeError.
The href attribute for the stylesheet is incorrect.
<html><body><scripttype="module" src="https://cdn.jsdelivr.net/npm/@finos/perspective@3.1.4/dist/cdn/perspective.js"></script><scripttype="module" src="https://cdn.jsdelivr.net/npm/@finos/perspective-viewer@3.1.4/dist/cdn/perspective-viewer.js"></script><scripttype="module" src="https://cdn.jsdelivr.net/npm/@finos/perspective-viewer-datagrid@3.1.4/dist/cdn/perspective-viewer-datagrid.js"></script><scripttype="module" src="https://cdn.jsdelivr.net/npm/@finos/perspective-viewer-d3fc@3.1.4/dist/cdn/perspective-viewer-d3fc.js"></script><linkrel="stylesheet" crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@finos/perspective-viewer-themes@3.1.4/dist/css/themes.css" />
<divclass="perspective-envelope" id="perspective-envelope-a512580a2efc414e960615bc991de7a9"><scripttype="application/vnd.apache.arrow.file">/////9gAAAAQAAAAAAAKAAwABgAFAAgACgAAAAABBAAMAAAACAAIAAAABAAIAAAABAAAAAMAAABwAAAAMAAAAAQAAACs////AAABAxAAAAAUAAAABAAAAAAAAAABAAAAeQAAANr///8AAAIA1P///wAAAQMQAAAAGAAAAAQAAAAAAAAAAQAAAHgABgAIAAYABgAAAAAAAgAQABQACAAGAAcADAAAABAAEAAAAAAAAQIQAAAAIAAAAAQAAAAAAAAABQAAAGluZGV4AAAACAAMAAgABwAIAAAAAAAAAUAAAAD/////6AAAABQAAAAAAAAADAAWAAYABQAIAAwADAAAAAADBAAYAAAASAAAAAAAAAAAAAoAGAAMAAQACAAKAAAAfAAAABAAAAADAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAYAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABgAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAgAAAAAAAAAAAAAAAADwPwAAAAAAAABAAAAAAAAACEAAAAAAAADwPwAAAAAAAAhAAAAAAAAAAED/////AAAAAA==</script><perspective-viewerstyle="height: 690px;"></perspective-viewer><scripttype="module">// from MDNfunctionbase64ToBytes(base64){constbinString=atob(base64);returnUint8Array.from(binString,(m)=>m.codePointAt(0));}import*asperspectivefrom"https://cdn.jsdelivr.net/npm/@finos/perspective@3.1.4/dist/cdn/perspective.js";constviewerId=a512580a2efc414e960615bc991de7a9;constcurrentScript=document.scripts[document.scripts.length-1];constenvelope=document.getElementById(`perspective-envelope-${viewerId}`);constdataScript=envelope.querySelector('script[type="application/vnd.apache.arrow.file"]');;if(!dataScript)thrownewError('data script missing for viewer',viewerId);constdata=base64ToBytes(dataScript.textContent);constviewerAttrs={'group_by': [],'split_by': [],'filter': [],'sort': [],'aggregates': {},'columns': ['index','x','y'],'expressions': {},'plugin': 'Datagrid','plugin_config': {},'theme': None,'settings': True,'title': None,'version': '3.1.4'};// Create a new worker, then a new table promise on that worker.consttable=awaitperspective.worker().table(data.buffer);constviewer=envelope.querySelector('perspective-viewer');viewer.load(table);viewer.restore(viewerAttrs);</script></div></body></html>
After applying the modifications below, the output HTML file renders correctly:
widget/__init__.py
****************** 17,19 ****
import importlib
!
from string import Template
--- 17,19 ----
import importlib
! import json
from string import Template
****************** 259,264 ****
psp_cdn_perspective_viewer_themes=psp_cdn(
! "perspective-viewer-themes", "css/themes.css"
),
viewer_id=self.model_id,
! viewer_attrs=viewer_attrs,
b64_data=b64_data.decode("utf-8"),
--- 259,264 ----
psp_cdn_perspective_viewer_themes=psp_cdn(
! "perspective-viewer", "css/themes.css"
),
viewer_id=self.model_id,
! viewer_attrs=json.dumps(viewer_attrs),
b64_data=b64_data.decode("utf-8"),
templates/exported_widget.html.template
****************** 19,21 ****
import * as perspective from "$psp_cdn_perspective";
! const viewerId = $viewer_id;
const currentScript = document.scripts[document.scripts.length - 1];
--- 19,21 ----
import * as perspective from "$psp_cdn_perspective";
! const viewerId = "$viewer_id";
const currentScript = document.scripts[document.scripts.length - 1];
****************** 29,31 ****
// Create a new worker, then a new table promise on that worker.
! const table = await perspective.worker().table(data.buffer);
const viewer = envelope.querySelector('perspective-viewer');
--- 29,32 ----
// Create a new worker, then a new table promise on that worker.
! const worker = await perspective.worker();! const table = worker.table(data.buffer);
const viewer = envelope.querySelector('perspective-viewer');
The text was updated successfully, but these errors were encountered:
I am experiencing issues when converting the PerspectiveWidget object into a static HTML file using the following code:
However, the output
tmp.html
file does not display the Perspective view correctly due to the following issues:viewerId
is not assigned as a string.viewerAttrs
is not a properly formatted JSON object.await perspective.worker().table(data.buffer)
raisesTypeError
.href
attribute for the stylesheet is incorrect.After applying the modifications below, the output HTML file renders correctly:
The text was updated successfully, but these errors were encountered: