Forum Discussion
jonnyglass
5 years agoNew Member
Newbie Questions on dataViewMappings and ColorHelper
Hello All, I've been through the tutorials and have starting working my way through my first custom visual. Unfortunately it is a "real world" example and fairly complex. I'm reasonably familiar wi...
Anonymous
5 years agoNot applicable
Hi jonnyglass
You may refer to this blog to get more details about Color
For more details about data view mapping, you can refer to this code: PowerBI-visuals
public static customizeQuery(options: CustomizeQueryOptions): void {
var dataViewMapping = options.dataViewMappings[0];
if (!dataViewMapping || !dataViewMapping.categorical || !dataViewMapping.categorical.categories)
return;
if (options.preferHigherDataVolume) {
dataViewMapping.categorical.dataVolume = 4;
}
var dataViewCategories = <data.CompiledDataViewRoleForMappingWithReduction>dataViewMapping.categorical.categories;
var categoryItems = dataViewCategories.for.in.items;
if (!ArrayExtensions.isUndefinedOrEmpty(categoryItems)) {
var categoryType = categoryItems[0].type;
var objects: DataViewObjects;
if (dataViewMapping.metadata)
objects = dataViewMapping.metadata.objects;
if (CartesianChart.getIsScalar(objects, columnChartProps.categoryAxis.axisType, categoryType))
dataViewCategories.dataReductionAlgorithm = { sample: {} };
}
}
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MichaelBakker
4 years agoRegular Visitor
The ColorHelper you refer to has nothing to do with Power BI. Instead it is a component in the UWP toolkit.