Родитель
80249e4f94
Коммит
93aebf4ec2
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -11,12 +11,11 @@
|
|||
"core-js": "3.2.1",
|
||||
"powerbi-visuals-api": "^2.6.2",
|
||||
"powerbi-visuals-utils-dataviewutils": "2.2.1",
|
||||
"regenerator-runtime": "^0.13.3",
|
||||
"vega": "^5.9.1",
|
||||
"vega-lite": "^4.4.0"
|
||||
"regenerator-runtime": "^0.13.5",
|
||||
"vega": "^5.13.0",
|
||||
"vega-lite": "^4.13.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/vega": "^3.2.0",
|
||||
"powerbi-visuals-tools": "^3.1.5",
|
||||
"ts-loader": "6.1.0",
|
||||
"tslint": "^5.18.0",
|
||||
|
|
|
@ -16,6 +16,7 @@ import DataView = powerbi.DataView;
|
|||
import * as vega from 'vega';
|
||||
import * as vl from 'vega-lite';
|
||||
import { VisualSettings } from "./settings";
|
||||
import { Dict } from "vega-lite/build/src/util";
|
||||
|
||||
interface BarChartDataPoint {
|
||||
value: PrimitiveValue;
|
||||
|
@ -51,7 +52,7 @@ function visualTransform(options: VisualUpdateOptions) {
|
|||
});
|
||||
}
|
||||
|
||||
return {dataPoints, categoryTitle, valueTitle};
|
||||
return { dataPoints, categoryTitle, valueTitle };
|
||||
}
|
||||
|
||||
export class BarChart implements IVisual {
|
||||
|
@ -83,7 +84,7 @@ export class BarChart implements IVisual {
|
|||
return;
|
||||
}
|
||||
|
||||
const {dataPoints, categoryTitle, valueTitle} = r;
|
||||
const { dataPoints, categoryTitle, valueTitle } = r;
|
||||
const spec: vl.TopLevelSpec = {
|
||||
$schema: "https://vega.github.io/schema/vega-lite/v4.json",
|
||||
width: options.viewport.width,
|
||||
|
@ -94,12 +95,12 @@ export class BarChart implements IVisual {
|
|||
contains: "content"
|
||||
},
|
||||
data: {
|
||||
values: dataPoints
|
||||
values: dataPoints as Dict<any>
|
||||
},
|
||||
mark: "bar",
|
||||
encoding: {
|
||||
x: {field: "category", type: "ordinal", axis: {title: categoryTitle}},
|
||||
y: {field: "value", type: "quantitative", axis: {title: valueTitle}}
|
||||
x: { field: "category", type: "ordinal", axis: { title: categoryTitle } },
|
||||
y: { field: "value", type: "quantitative", axis: { title: valueTitle } }
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче