mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-23 16:41:22 +01:00
Hide performance graph labels when window is not wide enough
Affects issues: - Fixed #1959
This commit is contained in:
parent
806a1faf78
commit
b968ab3c43
@ -220,7 +220,7 @@ function mapToDataSeries(performanceData) {
|
||||
}
|
||||
|
||||
function performanceChart(id, playersOnlineSeries, tpsSeries, cpuSeries, ramSeries, entitySeries, chunkSeries) {
|
||||
graphs.push(Highcharts.stockChart(id, {
|
||||
const chart = Highcharts.stockChart(id, {
|
||||
rangeSelector: {
|
||||
selected: 2,
|
||||
buttons: linegraphButtons
|
||||
@ -270,7 +270,23 @@ function performanceChart(id, playersOnlineSeries, tpsSeries, cpuSeries, ramSeri
|
||||
enabled: true
|
||||
},
|
||||
series: [playersOnlineSeries, tpsSeries, cpuSeries, ramSeries, entitySeries, chunkSeries]
|
||||
}));
|
||||
});
|
||||
|
||||
function toggleLabels() {
|
||||
if (!chart || !chart.yAxis || !chart.yAxis.length) return;
|
||||
const newWidth = $(window).width();
|
||||
chart.yAxis[0].update({labels: {enabled: newWidth >= 900}});
|
||||
chart.yAxis[1].update({labels: {enabled: newWidth >= 900}});
|
||||
chart.yAxis[2].update({labels: {enabled: newWidth >= 1000}});
|
||||
chart.yAxis[3].update({labels: {enabled: newWidth >= 1000}});
|
||||
chart.yAxis[4].update({labels: {enabled: newWidth >= 1400}});
|
||||
chart.yAxis[5].update({labels: {enabled: newWidth >= 1400}});
|
||||
}
|
||||
|
||||
$(window).resize(toggleLabels);
|
||||
toggleLabels();
|
||||
|
||||
graphs.push(chart);
|
||||
}
|
||||
|
||||
function playersChart(id, playersOnlineSeries, sel) {
|
||||
|
Loading…
Reference in New Issue
Block a user