From b40eed2acc98a23414298ba67dc6086fe2b8c23a Mon Sep 17 00:00:00 2001 From: ZaneYork Date: Sat, 1 Jan 2022 09:27:18 +0800 Subject: [PATCH] chart fix --- static/charts.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/static/charts.html b/static/charts.html index c959452..737a81c 100644 --- a/static/charts.html +++ b/static/charts.html @@ -100,10 +100,9 @@ categories.add(parseInt(frame)) }) }) - categories = Array.from(categories).sort() - json.xAxis = { - categories: categories - } + categories = Array.from(categories).sort(function (a,b) { + return a > b ? 1 : (a === b ? 0 : -1) + }) json.series = $.map(positions, function (position) { if (!result[rank].hasOwnProperty(position)) { return null; @@ -118,9 +117,9 @@ }, data: $.map(categories, function (frame) { if (result[rank][position].hasOwnProperty(frame)) { - return [[parseInt(frame), (parseFloat(result[rank][position][frame].wp) * 100)]] + return [[frame, (parseFloat(result[rank][position][frame].wp) * 100)]] } else { - return [[parseInt(frame), null]] + return [[frame, null]] } }) }, { @@ -134,9 +133,9 @@ }, data: $.map(categories, function (frame) { if (result[rank][position].hasOwnProperty(frame)) { - return [[parseInt(frame), parseFloat(result[rank][position][frame].adp)]] + return [[frame, parseFloat(result[rank][position][frame].adp)]] } else { - return [[parseInt(frame), null]] + return [[frame, null]] } }) }]