markisme/TagCloud

I'm getting a problem which says my htmlElement is null but I don't understand why...

Closed this issue · 5 comments

import { Component } from '@angular/core';
import { Word, TagCloud} from "d3-tagcloud";

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

}

var el = document.getElementById("content");

let tagCloud = new TagCloud(el.value);

var alphas:any[]; 
alphas = ["1","2","3","4"] 

let tags:Word[]= alphas;

tagCloud.setData(tags);

<ion-header>
  <ion-navbar>
    <ion-title>
      Ionic Blank
    </ion-title>
  </ion-navbar>
</ion-header>

<ion-content padding>
  <canvas id="content"></canvas>
</ion-content>

Sorry for the delay. Actually you should get the element by @ViewChild in angular.

@estherrios2 BTW the element does not need to be <canvas..., <div... is appropriate. I will add an example for this package later.

Hi @markisme thank you for your reply! An example would be great, since I still haven’t been able to display the word cloud.

@estherrios2 Here is an example now. Just have a try.

Since you didn't let me know whether have your problem been resolved. I'm going to close this issue now. And feel free to open an issue for any problem exist.:smiley: