Simon J.K. Pedersen (skp@delegate.dk)
How to get started building your own
Everything you can do in a browser you can do in a visualization
* except for the fact the custom visuals are sandboxed
export interface IVisual extends extensibility.IVisual {
/** Notifies the IVisual of an update (data, viewmode, size change). */
update<T>(options: VisualUpdateOptions, viewModel: T): void;
/** Notifies the visual that it is being destroyed,
and to do any cleanup necessary (such as unsubscribing event handlers). */
destroy?(): void;
/** Gets the set of objects that the visual is currently displaying. */
enumerateObjectInstances?(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
}
Life cycle
Prequisites
The new way
How it used to be
What do we get?
{
"dataRoles": [],
"dataViewMappings": [],
"objects": {
"settings": {
"displayName": "Settings",
"properties": {
"baseUri": {
"displayName": "Server Url",
"type": {
"text": true
}
},
"toggle": {
"displayName": "Enable",
"type": {
"bool": true
}
},
"show": {
"displayName": "My Property Switch",
"type": {
"bool": true
}
}
}
}
},
"supportsHighlight": true|false,
"sorting": { ... }
}
Data Capabilities
{
"dataRoles": [
{
"displayName": "Category Data",
"name": "category",
"kind": 0
},
{
"displayName": "Measure Data",
"name": "measure",
"kind": 1
}
],
"dataViewMappings": [
{
"categorical": {
"categories": {
"for": {
"in": "category"
},
"dataReductionAlgorithm": {
"top": {}
}
},
"values": {
"select": [
{
"bind": {
"to": "measure"
}
}
]
}
}
}
]
}
//Kind
0 = Category
1 = Measure
2 = MeasureOrCategory
Single
"dataViewMappings":[
{
"conditions": [ ... ],
"categorical": { ... },
"single": { ... },
"table": { ... },
"matrix": { ... }
}
]
"dataViewMappings": {
"conditions": [
{ "Y": { "max": 1 } }
],
"single": {
"role": "Y"
}
}
Catagorical
"categorical": {
"categories": {
"for": { "in": "category" }
},
"values": {
"select": [
{ "bind": { "to": "measure" } }
]
}
}
Don't reinvent the wheel
Twitter: @simped
GitHub: https://github.com/sjkp/SJKP.PbiViz.HellowWorld
Mail: skp@delegate.dk / mail@sjkp.dk