Fix chart id
This commit is contained in:
parent
14c2e7c110
commit
4227c149ef
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="stats-container" :class="containerClass">
|
||||
<h2>{{ title() }}</h2>
|
||||
<div class="chart-container" :class="chartClass">
|
||||
<canvas id="chart" widht="400" height="400"></canvas>
|
||||
<div class="chart-container">
|
||||
<canvas :id="chartID" widht="400" height="400"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -38,8 +38,8 @@ export default class StatsPie extends Vue {
|
||||
return `stats-container-${this.statType}`;
|
||||
}
|
||||
|
||||
chartClass(): string {
|
||||
return `chart-container-${this.statType}`;
|
||||
chartID(): string {
|
||||
return `chart-${this.statType}`;
|
||||
}
|
||||
|
||||
mounted(): void {
|
||||
@ -51,9 +51,7 @@ export default class StatsPie extends Vue {
|
||||
}
|
||||
|
||||
renderPie(): void {
|
||||
const elem = document.getElementById(
|
||||
this.chartClass(),
|
||||
) as HTMLCanvasElement;
|
||||
const elem = document.getElementById(this.chartID()) as HTMLCanvasElement;
|
||||
const ctx = elem.getContext('2d') as CanvasRenderingContext2D;
|
||||
const sortedStats = this.stats.sort();
|
||||
const values = sortedStats.map((s) => s.count);
|
||||
|
Loading…
Reference in New Issue
Block a user