当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript vega.loader方法代码示例

本文整理汇总了TypeScript中vega-embed.vega.loader方法的典型用法代码示例。如果您正苦于以下问题:TypeScript vega.loader方法的具体用法?TypeScript vega.loader怎么用?TypeScript vega.loader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vega-embed.vega的用法示例。


在下文中一共展示了vega.loader方法的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.vega.loader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。