I'm getting a problem which says my htmlElement is null but I don't understand why...
Closed this issue · 5 comments
estherrios2 commented
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
Sorry for the delay. Actually you should get the element by @ViewChild
in angular.
markisme commented
@estherrios2 BTW the element does not need to be <canvas...
, <div...
is appropriate. I will add an example for this package later.
estherrios2 commented
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
@estherrios2 Here is an example now. Just have a try.
markisme commented
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: