Skip to content
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

Merged
merged 1 commit into from
Oct 5, 2024
Merged

Conversation

as6325400
Copy link
Contributor

Old PR

#2727

Change

Since the forceX method is no longer available after using multibarchart, 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?

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) {
Copy link
Member

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);

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alredy update

@meisterT meisterT added this pull request to the merge queue Oct 5, 2024
Merged via the queue into DOMjudge:main with commit b3db6ab Oct 5, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants