This is not a bug. Sorry, I didn't find a place to ask for help in this regards.
I am configuring Color Blind visual in Power BI following these instructions: https://github.com/okviz/lib-color-blindness
I got some compilation errors when I try to configure visual.ts file. Here is my code and under the errors I get.
public update(options: VisualUpdateOptions) {
this.settings = Visual.parseSettings(options && options.dataViews && options.dataViews[0]);
console.log('Visual update', options);
if (this.textNode) {
this.textNode.textContent = (this.updateCount++).toString();
}
if (options.dataViews && options.dataViews[0] && options.dataViews[0].metadata && options.dataViews[0].metadata.objects) {
let colorBlindObj = options.dataViews[0].metadata.objects ["colorBlind"];
if (colorBlindObj) {
let vision = <string>colorBlindObj["vision"];
if (vision !== undefined) {
this.vision = vision;
}
}
}
OKVizUtility.applyColorBlindVision(this.vision, this.element);
}
private static parseSettings(dataView: DataView): VisualSettings {
return <VisualSettings>VisualSettings.parse(dataView);
}
/**
* 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 {let objectName = options.objectName;
let objectEnumeration: VisualObjectInstance[] = [];
switch(objectName) {
//… (all the other visual properties here),
case "colorBlind":
objectEnumeration.push({
objectName: objectName,
properties: {
"vision": this.vision
},
selector: null
});
break;
}
return objectEnumeration;
}
}
Here are the errors:
ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts
./src/visual.ts 44:21-46
[tsl] ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts(44,22)
TS2314: Generic type 'Selection<GElement, Datum, PElement, PDatum>' requires 4 type argument(s).
@ ./.tmp/precompile/visualPlugin.ts 1:0-42 10:12-18 11:23-29
ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts
./src/visual.ts 50:23-25
[tsl] ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts(50,24)
TS2686: 'd3' refers to a UMD global, but the current file is a module. Consider adding an import instead.
@ ./.tmp/precompile/visualPlugin.ts 1:0-42 10:12-18 11:23-29
ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts
./src/visual.ts 78:8-20
[tsl] ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts(78,9)
TS2304: Cannot find name 'OKVizUtility'.
@ ./.tmp/precompile/visualPlugin.ts 1:0-42 10:12-18 11:23-29
3 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
Hei,
This is not a bug. Sorry, I didn't find a place to ask for help in this regards. I am configuring Color Blind visual in Power BI following these instructions: https://github.com/okviz/lib-color-blindness I got some compilation errors when I try to configure visual.ts file. Here is my code and under the errors I get.
"use strict";
import "./../style/visual.less"; import powerbi from "powerbi-visuals-api"; import VisualConstructorOptions = powerbi.extensibility.visual.VisualConstructorOptions; import VisualUpdateOptions = powerbi.extensibility.visual.VisualUpdateOptions; import IVisual = powerbi.extensibility.visual.IVisual; import EnumerateVisualObjectInstancesOptions = powerbi.EnumerateVisualObjectInstancesOptions; import VisualObjectInstance = powerbi.VisualObjectInstance; import DataView = powerbi.DataView; import VisualObjectInstanceEnumerationObject = powerbi.VisualObjectInstanceEnumerationObject;
import { VisualSettings } from "./settings"; export class Visual implements IVisual { private target: HTMLElement; private updateCount: number; private settings: VisualSettings; private textNode: Text; private element: d3.Selection;
private vision: string;
constructor(options: VisualConstructorOptions) {
console.log('Visual constructor', options);
this.target = options.element;
this.updateCount = 0;
this.element = d3.select(options.element);
this.vision = "Normal";
if (document) {
const new_p: HTMLElement = document.createElement("p");
new_p.appendChild(document.createTextNode("Update count:"));
const new_em: HTMLElement = document.createElement("em");
this.textNode = document.createTextNode(this.updateCount.toString());
new_em.appendChild(this.textNode);
new_p.appendChild(new_em);
this.target.appendChild(new_p);
}
}
}
Here are the errors:
ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts ./src/visual.ts 44:21-46 [tsl] ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts(44,22) TS2314: Generic type 'Selection<GElement, Datum, PElement, PDatum>' requires 4 type argument(s). @ ./.tmp/precompile/visualPlugin.ts 1:0-42 10:12-18 11:23-29
ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts ./src/visual.ts 50:23-25 [tsl] ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts(50,24) TS2686: 'd3' refers to a UMD global, but the current file is a module. Consider adding an import instead. @ ./.tmp/precompile/visualPlugin.ts 1:0-42 10:12-18 11:23-29
ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts ./src/visual.ts 78:8-20 [tsl] ERROR in C:\WINDOWS\system32\ColorBlind\src\visual.ts(78,9) TS2304: Cannot find name 'OKVizUtility'. @ ./.tmp/precompile/visualPlugin.ts 1:0-42 10:12-18 11:23-29
3 errors have detailed information that is not shown. Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
What am I doing wrong?
I hope you can help me.
Regards,
Ivonne E.