本文整理匯總了TypeScript中vega-embed.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: vegaEmbed
return this._resolver.getDownloadUrl(path).then(baseURL => {
const loader = vega.loader({
baseURL,
http: { credentials: 'same-origin' }
});
const options: EmbedOptions = {
actions: true,
defaultStyle: true,
...embedOptions,
mode,
loader
};
const el = document.createElement('div');
this.node.innerHTML = ''; // clear the output before attaching a chart
this.node.appendChild(el);
return vegaEmbed(el, data, options).then(result => {
// Add png representation of vega chart to output
if (!model.data['image/png']) {
return result.view.toImageURL('png').then(imageData => {
const data = { ...model.data, 'image/png': imageData.split(',')[1] };
model.setData({ data });
});
}
return void 0;
});
});
示例2: vegaEmbed
return this._resolver.getDownloadUrl(path).then(baseURL => {
const loader = vega.loader({ baseURL });
const options = {
mode,
loader,
actions: true
};
return vegaEmbed(this.node as HTMLBaseElement, data, options).then(result => {
// Add png representation of vega chart to output
if (!model.data['image/png']) {
return result.view.toImageURL('png').then(imageData => {
const data = { ...model.data, 'image/png': imageData.split(',')[1] };
model.setData({ data });
});
}
return void 0;
}).catch(error => {
// Add stderr message to output
const stderr = `Javascript Error: ${error.message}. This usually means there's a typo in your chart specification. See the JavaScript console for the full traceback.`;
const data = { 'application/vnd.jupyter.stderr': stderr };
model.setData({ data });
// Manually append stderr message to output and modify node attributes
this.node.innerHTML = `<pre>Javascript Error: ${error.message}. This usually means there's a typo in your chart specification. See the JavaScript console for the full traceback.</pre>`;
this.addClass('jp-RenderedText');
this.removeClass(VEGA_COMMON_CLASS);
this.node.setAttribute('data-mime-type', 'application/vnd.jupyter.stderr');
return void 0;
});
});
示例3: vegaEmbed
return this._resolver.getDownloadUrl(path).then(baseURL => {
const loader = vega.loader({ baseURL });
const options = {
actions: true,
...embedOptions,
mode,
loader
};
return vegaEmbed(this.node as HTMLBaseElement, data, options).then(result => {
// Add png representation of vega chart to output
if (!model.data['image/png']) {
return result.view.toImageURL('png').then(imageData => {
const data = { ...model.data, 'image/png': imageData.split(',')[1] };
model.setData({ data });
});
}
return void 0;
});
});