Forum Discussion
Why does developer visual work in one report but not in another?
Hi emmasaunders,
I see you're checking the console, but have you added any logging to your visual to see if it completes (or starts) rendering? When you create a new visual with pbiviz new, there are some boilerplate console.log statements for the constructor and the update methods - are these still in your code and appearing at all? If you're not even getting this far than it could well be something with the capabilites, or possibly something else in the code - it is possible to break the formatting pane if you're using an enumerateObjectInstances method and manipulating objects, for instance.
Are you able to share any code? I can take a look and see if I can offer some help for you if so.
Regards,
Daniel
Hi Daniel dm-p
Thanks. I have tried previously to add the module powerbi.extensibility.visual function for logExceptions to my code but it throws multiple errors. E.g. "descriptor function not assignable to Method decorator" and "import declaration conflicts with local declaration of powerbi".
https://microsoft.github.io/PowerBI-visuals/docs/how-to-guide/how-to-debug/
Where do I put this code? Does it go inside the module powerbi.extensibility.visual in node_modules > powerbi-visuals-api > index.d.ts? Can it go anywhere in src/visual.ts? Both options throw errors.
The forum won't let me post visual.ts because it's > 20k characters. Here is capabilities.json
{
"dataRoles": [
{
"displayName": "Bucket (x axis)",
"name": "category",
"kind": "Grouping"
},
{
"displayName": "Population frequency (y1 axis)",
"name": "population",
"kind": "Measure"
},
{
"displayName": "Sample frequency (y2 axis)",
"name": "sample",
"kind": "Measure"
}
],
"objects": {
"barsPop": {
"displayName": "Population bars",
"properties": {
"fill": {
"displayName": "Bar colour",
"type": { "fill": { "solid": { "color": true } } }
},
"transparency": {
"displayName": "Bar transparency",
"type": { "numeric": true }
}
}
},
"barsSample": {
"displayName": "Sample bars",
"properties": {
"fill": {
"displayName": "Bar colour",
"type": { "fill": { "solid": { "color": true } } }
},
"transparency": {
"displayName": "Bar transparency",
"type": { "numeric": true }
}
}
},
"xAxis": {
"displayName": "X axis",
"properties": {
"show": {
"displayName": "Show x axis",
"type": {
"bool": true
}
},
"title": {
"description": "Label to show under x axis",
"displayName": "X axis label",
"type": {
"text": true
}
}
}
},
"y1Axis": {
"displayName": "Y1 axis (left)",
"properties": {
"show": {
"displayName": "Show y1 axis",
"type": {
"bool": true
}
},
"title": {
"description": "Label to show on y1 axis",
"displayName": "Y1 axis label",
"type": {
"text": true
}
},
"units": {
"displayName": "Units",
"type": {
"formatting": {
"labelDisplayUnits": true
}
}
}
}
},
"section2": {
"displayName": "SECTION TWO",
"properties": {
"displayUnits": {
"displayName": "Display Units",
"type": {
"formatting": {
"labelDisplayUnits": true
}
}
},
"alignment": {
"displayName": "Alignment",
"type": {
"formatting": {
"alignment": true
}
}
},
"fontSize": {
"displayName": "fontSize",
"type": {
"formatting": {
"fontSize": true
}
}
}
}
},
"section3": {
"displayName": "SECTION THREE",
"properties": {
"filter": {
"type": {
"filter": true
}
},
"selfFilter": {
"type": {
"filter": {
"selfFilter": true
}
}
},
"selfFilterEnabled": {
"type": {
"operations": {
"searchEnabled": true
}
}
}
}
}
},
"suppressDefaultTitle": true,
"dataViewMappings": [
{
"conditions": [
{
"category": {
"min": 1,
"max": 1
},
"population": {
"min": 1,
"max": 1
},
"sample": {
"max": 1
}
}
],
"categorical": {
"categories": {
"for": {
"in": "category"
}
},
"values": {
"select": [
{ "bind": { "to": "population" } },
{ "bind": { "to": "sample" } }
]
}
}
}
]
}
package.json
{
"name": "visual",
"scripts": {
"pbiviz": "pbiviz",
"start": "pbiviz start",
"package": "pbiviz package",
"lint": "tslint -c tslint.json -p tsconfig.json"
},
"dependencies": {
"@babel/runtime": "7.6.0",
"@babel/runtime-corejs2": "7.6.0",
"@types/d3": "5.7.2",
"core-js": "3.2.1",
"d3": "5.12.0",
"powerbi-visuals-api": "~2.6.1",
"powerbi-visuals-utils-dataviewutils": "2.2.1",
"powerbi-visuals-utils-tooltiputils": "2.3.1"
},
"devDependencies": {
"ts-loader": "6.1.0",
"tslint": "^5.18.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "3.6.3"
}
}
tsconfig.json
{
"compilerOptions": {
"allowJs": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es6",
"sourceMap": true,
"outDir": "./.tmp/build/",
"moduleResolution": "node",
"declaration": true,
"lib": [
"es2015",
"dom"
]
},
"files": [
"./src/visual.ts"
]
}
When the visual doesn't work, the constructor function runs, but not the update function. thanks for any help