Skip to content

Commit

Permalink
Fix tagcloud word overlapping (elastic#81161) (elastic#81300)
Browse files Browse the repository at this point in the history
* Fix overlaps on resize

* Set up font family

* Update snapshots
  • Loading branch information
sulemanof authored Oct 21, 2020
1 parent d39e16a commit 0e23098
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.

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

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

6 changes: 5 additions & 1 deletion src/plugins/vis_type_tagcloud/public/components/tag_cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ export class TagCloud extends EventEmitter {
this.resize();

//SETTING (non-configurable)
this._fontFamily = 'Open Sans, sans-serif';
/**
* the fontFamily should be set explicitly for calculating a layout
* and to avoid words overlapping
*/
this._fontFamily = 'Inter UI, sans-serif';
this._fontStyle = 'normal';
this._fontWeight = 'normal';
this._spiral = 'archimedean'; //layout shape
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ export const TagCloudChart = ({
() =>
throttle(() => {
if (visController.current) {
visController.current.render().then(renderComplete);
visController.current.render(visData, visParams).then(renderComplete);
}
}, 300),
[renderComplete]
[renderComplete, visData, visParams]
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,8 @@ export class TagCloudVisualization {
}

async render(data, visParams) {
if (data && visParams) {
this._updateParams(visParams);
this._updateData(data);
}

this._updateParams(visParams);
this._updateData(data);
this._resize();

await this._renderComplete$.pipe(take(1)).toPromise();
Expand Down

0 comments on commit 0e23098

Please sign in to comment.