Use a smaller font when device or folder counts are above 4 digits
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<div class="chart-container">
|
<div class="chart-container">
|
||||||
<canvas id={{elementID}} width="100px" height="100px"></canvas>
|
<canvas id={{elementID}} width="100px" height="100px"></canvas>
|
||||||
<div class="center" fxLayout="column" fxLayoutAlign="center center">
|
<div class="center" fxLayout="column" fxLayoutAlign="center center">
|
||||||
<div class="count">{{count}}</div>
|
<div class="{{_countClass}}">{{_count}}</div>
|
||||||
<div class="title">{{title}}</div>
|
<div class="title">{{title}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -13,25 +13,30 @@
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.count {
|
|
||||||
font-size: calc(1rem + 0.625vw);
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: calc(0.5rem + 0.625vw);
|
font-size: calc(0.5rem + 0.625vw);
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
.count-total {
|
||||||
|
font-size: calc(1rem + 0.625vw);
|
||||||
}
|
}
|
||||||
@media (min-width: 640px) and (max-width: 1000px) {
|
|
||||||
|
.large-count-total {
|
||||||
|
font-size: calc(0.5rem + 0.625vw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
.count-total {
|
||||||
|
font-size: calc(1.00rem + 0.625vw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 800px) and (max-width: 1000px) {
|
||||||
.title {
|
.title {
|
||||||
display:none;
|
|
||||||
font-size: calc(0.35rem + 0.625vw);
|
font-size: calc(0.35rem + 0.625vw);
|
||||||
}
|
}
|
||||||
|
|
||||||
.count {
|
.count-total {
|
||||||
font-size: calc(1.35rem + 0.625vw);
|
font-size: calc(1.35rem + 0.625vw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,14 @@ import { tooltip } from '../tooltip'
|
|||||||
export class DonutChartComponent {
|
export class DonutChartComponent {
|
||||||
@Input() elementID: string;
|
@Input() elementID: string;
|
||||||
@Input() title: number;
|
@Input() title: number;
|
||||||
count: number;
|
_count: number;
|
||||||
|
_countClass = "count-total";
|
||||||
|
set count(n: number) {
|
||||||
|
if (n >= 1000) { // use a smaller font
|
||||||
|
this._countClass = "large-count-total"
|
||||||
|
}
|
||||||
|
this._count = n;
|
||||||
|
}
|
||||||
|
|
||||||
private canvas: any;
|
private canvas: any;
|
||||||
private ctx: any;
|
private ctx: any;
|
||||||
@@ -50,7 +57,7 @@ export class DonutChartComponent {
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
cutoutPercentage: 75,
|
cutoutPercentage: 77,
|
||||||
responsive: true,
|
responsive: true,
|
||||||
legend: {
|
legend: {
|
||||||
display: false
|
display: false
|
||||||
|
|||||||
Reference in New Issue
Block a user