1
我使用PowerBI(https://github.com/Microsoft/PowerBI-visuals-tools)的可視化工具創建了一個新項目,然後手動安裝了d3(@^3.5.5)及其類型定義(@ types/d3 @^3.5。 5)。有什麼令我費解的是src
文件夾的visual.ts
裏面,我可以使用d3沒有任何進口,有沒有人可以解釋爲什麼?PowerBI-visuals-tools d3導入
module powerbi.extensibility.visual {
"use strict";
export class Visuall implements IVisual {
private target: HTMLElement;
private updateCount: number;
private settings: VisualSettings;
constructor(options: VisualConstructorOptions) {
console.log('Visual constructor', options);
this.target = options.element;
this.updateCount = 0;
}
public update(options: VisualUpdateOptions) {
this.settings = Visual.parseSettings(options && options.dataViews && options.dataViews[0]);
console.log('Visual update', options);
this.target.innerHTML = `<p>Update count: <em>${(this.updateCount++)}</em></p>`;
console.log(d3); // no error whatsoever
}
private static parseSettings(dataView: DataView): VisualSettings {
return VisualSettings.parse(dataView) as VisualSettings;
}
/**
* This function gets called for each of the objects defined in the capabilities files and allows you to select which of the
* objects and properties you want to expose to the users in the property pane.
*
*/
public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options);
}
}
}