Comments (3)
capabilities were always meant to be static, and not instance specific (thus the reason for them being in a static variable). Changing them at run time can produce undesired behavior during dataview transform since the Power BI clients expect them to be static.
We do want to allow custom visuals in the future to customize their query at runtime (change dataview mappings & roles). Could you give me an example of when you want to dynamically change dataview objects?
from powerbi-visuals-tools.
Thanks for reply!
I didn't mean to change dataview objects dynamically but to generate dataview object descriptors at runtime according to my settings or some other states to be persisted.
here's the example I mentioned in the last post:
class SettingService {
// register type of visual setting
public register(settingType);
// convert registered settings to pbi dataview object descriptors
public getRequiredObject(): { [objectName: string]: DataViewObjectDescriptor };
// other possible functions
public save(setting);
public load(settingType);
...
}
// decorator defines how to map setting to dataview object
@mapToPbiObject({objectName: "layout"})
class LayoutSetting {
// decorator defines how to map setting option to dataview object property
@mapToPbiProperty({propertyName: "overflow",default: "scroll"})
public overflow: string;
@mapToPbiProperty({propertyName: "minWidth",default: 20})
public minWidth: number;
}
var settingService: SettingService;
settingService.register(LayoutSetting);
export class MyVisual implements IVisual {
public static capabilities: VisualCapabilities = {
// define data roles, dataview mappings and etc.
...
// define dataview objects
// generate required dataview object descriptors according to registered settings.
objects: settingService.getRequiredObject();
}
}
there's similar requirement for other (inner) fields of capabilities
such as conditions
field of DataViewMapping
(which is the element type of dataViewMappings
field).
for example, I currently work on a visual with multiple roles, for which I have to decide all valid combinations of the count of fields assigned to each role, and then generate a set of conditions at runtime. and the result set could be change at each update of business logic. it's really bad for me to offline calculate these conditions each time I update the logic.
conclusion
although capabilities
must be defined before visual initializing and be immutable in the whole lifetime of the visual, that doesn't mean capabilities
must be designed as static. it could be dynamically generated before the visual initializing just as traditional (two) approaches do, and this could benefit us with extra flexibility.
from powerbi-visuals-tools.
Closing this issue since the new version of powerbi-visuals-api allows you to implement settings dynamically
from powerbi-visuals-tools.
Related Issues (20)
- Visualisation des données de l'agence emploi jeune CI
- Rapport présentant la proportion d'hommes et de femmes qui demandent de l'emploi en CÔTE D'IVOIRE.
- Rapport montrant la répartition des produits de consommation en Côte d’Ivoire HOT 1
- Unable to create visual; HOT 4
- Unable to create visual HOT 1
- unable to install pbiviz HOT 1
- If a visual filtered by a date type field, then the selection is not working well. HOT 1
- Packed visual behaves differently. DataViewMetadata has different entries for the same data mapping in dev/prod mode HOT 2
- Passing query parameter to server HOT 3
- Capabilitie of ImageUpload HOT 1
- geolocation error - disabled by default (feature request) HOT 6
- tsconfig parsing breaks if you include any comments HOT 1
- The 'Show DatavView' button does not work HOT 2
- Tutorial on creating an R-powered Power BI visual is not updated HOT 5
- API Dialog box HOT 7
- pbiviz package -> [ERR_REQUIRE_ESM]: require() of ES Module HOT 7
- Total and Subtotal API not working with select-for-in expression in the data view mapping of the matrix object
- powerbi-client + custom visual. Setting border value HOT 5
- [>= 5.4.2] Uncaught ReferenceError: global is not defined HOT 1
- Custom Visual Library Support for Open AI in Power BI Web HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powerbi-visuals-tools.