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