mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
Add word cloud custom weight fucntion
This commit is contained in:
@@ -69,20 +69,34 @@ export class SearchPage implements OnInit {
|
||||
|
||||
wordCloud(){
|
||||
|
||||
this.search.mostSeachWord("10").subscribe(res=>{
|
||||
this.search.mostSeachWord("15").subscribe(res=>{
|
||||
|
||||
const container = document.querySelector('.most-searched-word-container');
|
||||
|
||||
container.setAttribute('style',`height: ${window.innerWidth}px`);
|
||||
|
||||
let list = []
|
||||
|
||||
const highest= res[0].Hits;
|
||||
const lowest = res[res.length-1].Hits;
|
||||
const range = highest - lowest;
|
||||
const perPercent = range / 100;
|
||||
let list = [];
|
||||
|
||||
res.forEach(element => {
|
||||
list.push(Object.values(element))
|
||||
// minimum font sixe
|
||||
// Editable -----------------------------------
|
||||
const minimumSize = 9;
|
||||
// Change scale
|
||||
// Editable ------------------------------------
|
||||
const multiplicator = 0.56;
|
||||
|
||||
res.forEach(e => {
|
||||
const array: any = Object.values(e);
|
||||
|
||||
array[1] = (((array[1] - lowest) / perPercent) * multiplicator) + minimumSize;
|
||||
list.push(array)
|
||||
});
|
||||
|
||||
this.list = list
|
||||
|
||||
|
||||
const elem = document.documentElement.querySelector('.most-searched-word-container');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user