Skip to content

Commit f4146c3

Browse files
authored
v2.2.0 - Added rendering events (#95)
* add rendering events
1 parent c1308ac commit f4146c3

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.2.0
2+
### Visual changes
3+
*Add rendering events.
4+
15
## 2.1.2
26
### Visual changes
37
* Tailor title text if it's too long

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dualkpi",
33
"displayName": "Dual KPI",
4-
"version": "2.1.2.0",
4+
"version": "2.2.0.0",
55
"description": "Dual KPI efficiently visualizes two measures over time. It shows their trend based on a joint timeline, while absolute values may use different scales, for example Profit and Market share or Sales and Profit. Each KPI can be visualized as line chart or area chart. The visual has dynamic behavior and can show historical value and the change from the latest value when you hover over it. It also has small icons and labels to convey KPI definitions and alerts about data freshness. Customize colors, titles, axis properties, tooltips, and more, to create visually appealing and functional executive dashboards.",
66
"author": {
77
"name": "Microsoft",

pbiviz.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"visual": {
33
"name": "dualKpi",
4-
"displayName": "Dual KPI 2.1.2.0",
4+
"displayName": "Dual KPI 2.2.0.0",
55
"guid": "PBI_CV_3C80B1F2_09AF_4123_8E99_C3CBC46B23E0",
66
"visualClassName": "DualKpi",
7-
"version": "2.1.2.0",
7+
"version": "2.2.0.0",
88
"description": "Dual KPI efficiently visualizes two measures over time. It shows their trend based on a joint timeline, while absolute values may use different scales, for example Profit and Market share or Sales and Profit. Each KPI can be visualized as line chart or area chart. The visual has dynamic behavior and can show historical value and the change from the latest value when you hover over it. It also has small icons and labels to convey KPI definitions and alerts about data freshness. Customize colors, titles, axis properties, tooltips, and more, to create visually appealing and functional executive dashboards.",
99
"supportUrl": "http://community.powerbi.com",
1010
"gitHubUrl": "https://github.com/Microsoft/powerbi-visuals-dualkpi"

src/visual.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ import VisualConstructorOptions = powerbi.extensibility.visual.VisualConstructor
7575
import VisualUpdateOptions = powerbi.extensibility.visual.VisualUpdateOptions;
7676
import IColorPalette = powerbi.extensibility.IColorPalette;
7777
import ISelectionManager = powerbi.extensibility.ISelectionManager;
78+
import IVisualEventService = powerbi.extensibility.IVisualEventService;
7879

7980
import IValueFormatter = ValueFormatter.IValueFormatter;
8081
import valueFormatter = ValueFormatter;
@@ -202,6 +203,7 @@ export class DualKpi implements IVisual {
202203
private target: HTMLElement;
203204
private size: DualKpiSize;
204205
private sizeCssClass: DualKpiSizeClass;
206+
private eventService: IVisualEventService
205207

206208
private svgRoot: d3Selection<SVGSVGElement, unknown, null, undefined>;
207209

@@ -263,6 +265,7 @@ export class DualKpi implements IVisual {
263265

264266
private init(options: VisualConstructorOptions): void {
265267
this.target = options.element;
268+
this.eventService = options.host.eventService
266269
this.size = DualKpiSize.small;
267270
this.sizeCssClass = "small";
268271
this.valueFormatter = d3Format(".3s");
@@ -480,9 +483,9 @@ export class DualKpi implements IVisual {
480483
}
481484

482485
public update(options: VisualUpdateOptions) {
486+
this.eventService.renderingStarted(options)
483487
try {
484488
const dataView: DataView = this.dataView = options.dataViews && options.dataViews[0];
485-
486489
if (!dataView ||
487490
!dataView.metadata ||
488491
!dataView.metadata.columns) {
@@ -523,8 +526,10 @@ export class DualKpi implements IVisual {
523526
if (wasDataSetRendered) {
524527
this.drawBottomContainer(chartWidth, chartHeight, chartTitleSpace, chartSpaceBetween, iconOffset);
525528
}
529+
this.eventService.renderingFinished(options)
526530
} catch (e) {
527531
console.error(e);
532+
this.eventService.renderingFailed(options , e)
528533
}
529534
}
530535

0 commit comments

Comments
 (0)