Skip to content

Commit

Permalink
Selection fix (#129)
Browse files Browse the repository at this point in the history
* Change behavior

* Add workaround to deselection

* Increase visual version

* Update comment

---------

Co-authored-by: Iuliia Kulagina <v-ikulagina@microsoft.com>
  • Loading branch information
kullJul and kullJul authored Oct 4, 2024
1 parent 40e1a44 commit 1098be4
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 206 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.3.4.0
### Visual changes:
* Fix bug with resetting the selection

## 2.3.3.0
### Visual changes:
* Fix bug with bookmarks
Expand Down
67 changes: 3 additions & 64 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "powerbi-visuals-wordcloud",
"version": "2.3.3.0",
"version": "2.3.4.0",
"description": "Word Cloud is a visual representation of word frequency and value. Use it to get instant insight into the most important terms in a set.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -33,9 +33,7 @@
"d3-transition": "^3.0.1",
"lodash.clone": "^4.5.0",
"lodash.difference": "^4.5.0",
"lodash.flatten": "^4.4.0",
"lodash.includes": "^4.3.0",
"lodash.isarray": "^4.0.0",
"lodash.isempty": "^4.4.0",
"lodash.isstring": "^4.0.1",
"lodash.keys": "^4.2.0",
Expand All @@ -59,9 +57,7 @@
"@types/karma": "^6.3.8",
"@types/lodash.clone": "^4.5.9",
"@types/lodash.difference": "^4.5.9",
"@types/lodash.flatten": "^4.4.9",
"@types/lodash.includes": "^4.3.9",
"@types/lodash.isarray": "^4.0.9",
"@types/lodash.isempty": "^4.4.9",
"@types/lodash.isstring": "^4.0.9",
"@types/lodash.keys": "^4.2.9",
Expand Down
4 changes: 2 additions & 2 deletions pbiviz.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"visual": {
"name": "WordCloud",
"displayName": "WordCloud 2.3.3.0",
"displayName": "WordCloud 2.3.4.0",
"guid": "WordCloud1447959067750",
"visualClassName": "WordCloud",
"version": "2.3.3.0",
"version": "2.3.4.0",
"description": "Word Cloud is a visual representation of word frequency and value. Use it to get instant insight into the most important terms in a set.",
"supportUrl": "https://community.powerbi.com",
"gitHubUrl": "https://github.com/Microsoft/PowerBI-visuals-WordCloud"
Expand Down
20 changes: 2 additions & 18 deletions src/WordCloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,24 +794,7 @@ export class WordCloud implements IVisual {
this.colorPalette = options.host.colorPalette;
this.visualHost = options.host;
const selectionManager: ISelectionManager = this.visualHost.createSelectionManager();
this.behavior = new WordCloudBehavior(selectionManager,
(text: string): ISelectionId[] => {
const dataPoints: WordCloudDataPoint[] = this.data
&& this.data.dataPoints
&& this.data.dataPoints.filter((dataPoint: WordCloudDataPoint) => {
return dataPoint.text.toLocaleLowerCase() === text;
});

return (
dataPoints && dataPoints[0] && dataPoints[0].selectionIds
? dataPoints[0].selectionIds
: []
);
},
() => {
return this.data.dataPoints;
}
);
this.behavior = new WordCloudBehavior(selectionManager);

this.layout = new VisualLayout(null, WordCloud.DefaultMargin);

Expand Down Expand Up @@ -1473,6 +1456,7 @@ export class WordCloud implements IVisual {
};

this.behavior.bindEvents(behaviorOptions);
this.behavior.renderSelection();
}

private scaleMainView(wordCloudDataView: WordCloudDataView): void {
Expand Down
Loading

0 comments on commit 1098be4

Please sign in to comment.