Add zoom to chart

This commit is contained in:
amcmanu3 2022-08-21 21:47:05 -04:00
parent 4225de55e8
commit 7e5d6fddda
4 changed files with 10 additions and 3 deletions

View File

@ -41,6 +41,7 @@
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<script defer src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-zoom/0.6.6/chartjs-plugin-zoom.min.js"></script>
<!-- End Bootstrap Toggle -->

View File

@ -30,7 +30,7 @@
{% if data['permissions']['Players'] in data['user_permissions'] and data['server_data']['type'] != 'minecraft-bedrock' %}
<a class="dropdown-item {% if data['active_link'] == 'admin_controls' %}active{% end %}" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=admin_controls" role="tab" aria-selected="true"><i class="fas fa-users"></i> {{ translate('serverDetails', 'playerControls', data['lang']) }}</a>
{% end %}
<a class="dropdown-item {% if data['active_link'] == 'metrics' %}active{% end %}" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=metrics" role="tab" aria-selected="true"><i class="fas fa-users"></i>Metrics</a>
<a class="dropdown-item {% if data['active_link'] == 'metrics' %}active{% end %}" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=metrics" role="tab" aria-selected="true"><i class='fas fa-chart-area'></i>Metrics</a>
</div>
</div>
</div>

View File

@ -51,6 +51,6 @@
{% end %}
<li class="nav-item term-nav-item">
<a class="nav-link {% if data['active_link'] == 'metrics' %}active{% end %}" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=metrics" role="tab" aria-selected="true">
<i class="fas fa-users"></i>Metrics</a>
<i class='fas fa-chart-area'></i>Metrics</a>
</li>
</ul>

View File

@ -62,7 +62,9 @@
const ram = []
const cpu = []
{% for item in data['history_stats'] %}
{% if 'minecraft-java' in data['server_stats']['server_type'] %}
players.push("{{ item.online }}");
{% end %}
dates.push("{{ item.created }}");
ram.push("{{ item.mem_percent }}")
cpu.push("{{ item.cpu }}")
@ -109,7 +111,11 @@
max: Math.max.apply(this, max_nums) + 5
}
}]
}
},
zoom: {
enabled: true,
mode: 'y'
},
}
});