forked from iarv/sthlm-mesh
Consistent sizing of charts
This commit is contained in:
@@ -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)';
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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, {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user