键入'{[x:字符串]:PrimitiveValue []; }”缺少“ WordCloudColumns”类型的以下属性:类别,值,排除
power bi自定义视觉单词冲突开源
import powerbi from "powerbi-visuals-api";
import * as _ from "lodash";
// powerbi
import DataView = powerbi.DataView;
import DataViewValueColumns = powerbi.DataViewValueColumns;
import DataViewCategoryColumn = powerbi.DataViewCategoryColumn;
import DataViewCategoricalColumn=powerbi.DataViewCategoricalColumn;
import DataViewCategorical = powerbi.DataViewCategorical;
import PrimitiveValue = powerbi.PrimitiveValue;
import DataViewValueColumn = powerbi.DataViewValueColumn;
export class WordCloudColumns<T> {
public static getCategoricalValues(dataView: DataView): WordCloudColumns<DataViewCategoryColumn[]> {
let categorical: DataViewCategorical = dataView && dataView.categorical,
categories: DataViewCategoryColumn[] = categorical && categorical.categories || [],
values: DataViewValueColumns = categorical && categorical.values || [] as DataViewValueColumns,
series: PrimitiveValue[] = categorical && values.source && this.getSeriesValues(dataView);
return categorical && _.mapValues((new this<DataViewCategoryColumn[]>() as any), (n: any, key: string) => {
return (<any[]>_.toArray(categories))
.concat(<any[]>_.toArray(values))
.filter((column: DataViewCategoryColumn) => column.source.roles && column.source.roles[key])
.map((column: DataViewCategoryColumn) => column.values)[0]
|| values.source
&& values.source.roles
&& values.source.roles[key]
&& series;
});
}
// Data Roles
public Category: T = null;
public Values: T = null;
public Excludes: T = null;
}
返回错误,错误消息:
键入'{[x:字符串]:PrimitiveValue []; }”缺少“ WordCloudColumns”类型的以下属性:类别,值,排除