-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit the labels on the x-axis #2732
Conversation
let this_minute_submission_nums = 0; | ||
submission_stats.forEach(stat => { | ||
this_minute_submission_nums += stat.values[minute][1]; | ||
}); | ||
max_submissions_per_minute = Math.max(max_submissions_per_minute, this_minute_submission_nums); | ||
} | ||
|
||
function generate_values(start_point, end_point, number_of_points) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can this both simpler and nicer:
This will make sure that the ticks we use are still limited but are nice. In the default 5h long contest, every 15 minutes there is a tick, for longer contests, it increases to 30mins, 60mins and so on.
// Pick a nice round tickDelta and tickValues
var tickDelta = 15;
while (contest_duration_minutes / tickDelta > 15) {
tickDelta *= 2;
}
var tickValues = Array.from({ length: Math.ceil(contest_duration_minutes / tickDelta) + 1 }, (_, i) => i * tickDelta);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the unit will always be in minutes?
If we take a classroom scenario, it's quite common for a contest to last an entire semester.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right that we also would want to fall back to larger units than minutes when the contest duration is that long - I assume we should do that in the same change that adds the limitation to 300 buckets/bars. Do you rather want to do this in this PR or separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's handle it separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alredy update
update delta
Old PR
#2727
Change
Since the
forceX
method is no longer available after usingmultibarchart
, it causes the x-axis labels to be misaligned, and I can't set the competition end time as the final label. Therefore, I force interpolation to fill in the x-axis labels (I haven't thought of a better solution yet).In addition to 0 and the end time, I will insert 9 additional points. This should handle all competitions where the duration is a multiple of 10.
Next
Additionally, according to the last PR, the data size of the table uses
min(minutes, 300)
. How should I create the labels in this case? For example, if there is a competition that lasts for a week, should the unit of my labels still be in minutes?