Consistent sizing of charts

This commit is contained in:
Anton Roslund
2025-04-19 22:06:38 +02:00
parent c0ceb4793d
commit 27d323047f
6 changed files with 6 additions and 6 deletions

View File

@@ -27,7 +27,7 @@ async function deviceRolesChart() {
// Dynamically size the container based on the number of elements
const chartContainer = document.getElementById('deviceRolesContainer');
chartContainer.style.height = `${labels.length *35}px`;
chartContainer.style.height = `${labels.length *35 + 50}px`;
const backgroundColors = labels.map(label => {
if (label == "ROUTER_CLIENT") return 'rgb(196, 36, 18)';

View File

@@ -40,7 +40,7 @@ async function firmwareVersionGraph() {
const counts = sorted.map(entry => entry.count);
const chartContainer = document.getElementById('firmwareVersionContainer');
chartContainer.style.height = `${labels.length * 35}px`;
chartContainer.style.height = `${labels.length * 35 + 50}px`;
new Chart(ctx, {
type: 'bar',

View File

@@ -29,7 +29,7 @@ async function hardwareStatsGraph() {
// Adjust chart height based on number of items
const chartContainer = document.getElementById('hardwareChartContainer');
chartContainer.style.height = `${labels.length * 25}px`;
chartContainer.style.height = `${labels.length * 25 + 50}px`;
new Chart(ctx, {

View File

@@ -17,7 +17,7 @@ async function mostActiveNodesGraph() {
// Adjust chart height based on number of items
const chartContainer = document.getElementById('mostActiveNodesContainer');
chartContainer.style.height = `${labels.length * 25}px`;
chartContainer.style.height = `${labels.length * 22 + 50}px`;
const backgroundColors = counts.map(count => {
if (count < 100) return '#7EB26D'; // Green

View File

@@ -134,7 +134,7 @@ async function portnumDistributionChart(nodeId = null) {
});
const chartContainer = document.getElementById('portnumDistributionContainer');
chartContainer.style.height = `${labels.length * 35}px`;
chartContainer.style.height = `${labels.length * 35 + 50}px`;
if (chartInstance) chartInstance.destroy();

View File

@@ -114,7 +114,7 @@ async function positionPrecisionGraph() {
const backgroundColors = sorted.map(entry => getPositionColor(entry.precision));
const chartContainer = document.getElementById('positionPrecisionContainer');
chartContainer.style.height = `${labels.length *35}px`;
chartContainer.style.height = `${labels.length * 35 + 50}px`;
new Chart(ctx, {
type: 'bar',