markisme / TagCloud

A Word/Tag Cloud Library in Typescript.
MIT License
2 stars 1 forks source link

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

Closed estherrios2 closed 6 years ago

estherrios2 commented 6 years ago
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>
markisme commented 6 years ago

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

markisme commented 6 years ago

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

estherrios2 commented 6 years ago

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

markisme commented 6 years ago

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

markisme commented 6 years ago

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: