Skip to content

Commit

Permalink
Added highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
310267217 authored and 310267217 committed Jun 24, 2022
1 parent e36840f commit 100f987
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
22 changes: 21 additions & 1 deletion src/visual.ts
Expand Up @@ -41,6 +41,11 @@ import ISelectionManager = powerbi.extensibility.ISelectionManager; // added for
import ISelectionId = powerbi.visuals.ISelectionId; //added for selections
import IVisualHost = powerbi.extensibility.visual.IVisualHost; // added for selections

import {
select as d3Select
} from "d3-selection";


import { VisualSettings } from "./settings";
export class Visual implements IVisual {
private settings: VisualSettings;
Expand Down Expand Up @@ -98,9 +103,24 @@ export class Visual implements IVisual {

//pass SelectionId to the selectionManager
recSelectionMerged.on('click', (d) => {
this.selectionManager.select(d[2])
this.selectionManager.select(d[2]).then((ids: ISelectionId[]) => {
//for all rectangles do
recSelectionMerged.each(function (s) {
// if the selection manager returns no id's, then opacity 0.9,
// if the element s matches the selection (ids), then 0.7 else 0.3
let op = !ids.length ? 0.9 : s[2] == ids[0] ? 0.7 : 0.3
d3Select(this)
.transition()
.style("fill-opacity", op)
.duration(1000)
})
})
})

recSelectionMerged
.exit()
.remove();

}

private static parseSettings(dataView: DataView): VisualSettings {
Expand Down

0 comments on commit 100f987

Please sign in to comment.