Create a table chart

Last updated

Last updated
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
export default class extends Component {
@service lianaServerFetch;
@tracked users;
constructor(...args) {
super(...args);
this.fetchData();
}
/** Load data from agent, and pass it to the template */
async fetchData() {
const response = await this.lianaServerFetch.fetch(
'/forest/_charts/mytablechart',
{},
);
this.users = await response.json();
}
}<BetaTable
@columns={{array 'Username' 'Points'}}
@rows={{this.users}}
@alignColumnLeft={{true}}
as |RowColumn user|
>
<RowColumn>
<span>{{user.username}}</span>
</RowColumn>
<RowColumn>
<span>{{user.points}}</span>
</RowColumn>
</BetaTable>