當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript vega-embed.default函數代碼示例

本文整理匯總了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;
   });
 });
開發者ID:groutr,項目名稱:jupyterlab,代碼行數:26,代碼來源:index.ts

示例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;
   });
 });
開發者ID:gnestor,項目名稱:jupyterlab,代碼行數:29,代碼來源:index.ts

示例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;
   });
 });
開發者ID:datadesk,項目名稱:jupyterlab,代碼行數:19,代碼來源:index.ts


注:本文中的vega-embed.default函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。