Forum Discussion
Does anyone have a working example of the Customized data reduction capabilities in a matrix?
Hi saviourofdp,
I had to add a suitable class and properties to my visual settings that correspond to the capabilities (as has always been the way), otherwise these properties are not accessible to your VisualSettings class (or whatever name you have chosen for it). If your enumerateObjectInstances method has standard logic to populate the pane and you're not overriding your own containers too heavily, then there shouldn't be anything you need to do. However if you are doing this then it's going to depend on how you're building them.
If you're using the new formatting model (cards) that were introduced in API 5.1, you still need to add settings classes and properties - and the revised guide to the formatting pane still includes this step if you need to confirm what this should look like - but you won't need to use enumerateObjectInstances if using the new pane; I believe the new powerbi-visuals-utils-formattingmodel package takes care of that if you're using them. If not, then you will need to set up your own overridden getFormattingModel method in the Visual class that has your logic to return a valid FormattingModel.
Regards,
Daniel
Thanks for your help dm-p . I've found that for a matrix to work, the relevant sections in the capabilities file needs to look like the following. In particular, the row algorithm needs to be set as window and columns algorithm needs to be set as something other than window. Otherwise, I see an error.
{
"dataRoles": [
{
"displayName": "Row Data",
"name": "rows",
"kind": "Grouping"
},
{
"displayName": "Column Data",
"name": "columns",
"kind": "Grouping"
},
{
"displayName": "Measure Data",
"name": "values",
"kind": "Measure"
}
],
"objects": {
"dataReductionCustomization": {
"properties": {
"columnCount": {
"type": {
"numeric": true
}
},
"rowCount": {
"type": {
"numeric": true
}
}
}
}
},
"privileges": [],
"dataViewMappings": [
{
"matrix": {
"dataVolume": 6,
"rows": {
"for": {
"in": "rows"
},
"dataReductionAlgorithm": {
"window": {
"count": 10
}
}
},
"columns": {
"for": {
"in": "columns"
},
"dataReductionAlgorithm": {
"sample": {
"count": 10
}
}
},
"values": {
"select": [
{
"for": {
"in": "values"
}
}
]
}
}
}
],
"dataReductionCustomization": {
"matrix": {
"columnCount": {
"defaultValue": 100,
"propertyIdentifier": {
"objectName": "dataReductionCustomization",
"propertyName": "columnCount"
}
},
"rowCount": {
"defaultValue": 100,
"propertyIdentifier": {
"objectName": "dataReductionCustomization",
"propertyName": "rowCount"
}
}
}
}
}