1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-07 05:07:21 +08:00

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.3 KiB
C#
Raw Normal View History

2020-02-08 00:10:17 +03:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2022-06-17 16:37:17 +09:00
#nullable disable
2020-02-08 00:10:17 +03:00
using System;
using System.Collections.Generic;
using System.Linq;
2020-03-21 14:35:04 +01:00
using JetBrains.Annotations;
using osu.Framework.Extensions.LocalisationExtensions;
2021-07-17 16:20:37 +02:00
using osu.Framework.Localisation;
using osu.Game.Online.API.Requests.Responses;
2020-02-08 00:10:17 +03:00
namespace osu.Game.Overlays.Profile.Sections.Historical
{
2020-03-10 00:50:12 +03:00
public class UserHistoryGraph : UserGraph<DateTime, long>
2020-02-08 00:10:17 +03:00
{
2021-07-17 16:20:37 +02:00
private readonly LocalisableString tooltipCounterName;
2020-03-21 14:35:04 +01:00
[CanBeNull]
public APIUserHistoryCount[] Values
2020-02-08 00:10:17 +03:00
{
2020-03-09 19:20:06 +03:00
set => Data = value?.Select(v => new KeyValuePair<DateTime, long>(v.Date, v.Count)).ToArray();
2020-02-08 00:10:17 +03:00
}
2021-07-17 16:20:37 +02:00
public UserHistoryGraph(LocalisableString tooltipCounterName)
{
this.tooltipCounterName = tooltipCounterName;
}
2020-03-10 00:50:12 +03:00
2020-02-12 20:19:20 +01:00
protected override float GetDataPointHeight(long playCount) => playCount;
2021-09-01 17:08:20 +09:00
protected override UserGraphTooltipContent GetTooltipContent(DateTime date, long playCount) =>
new UserGraphTooltipContent(
tooltipCounterName,
playCount.ToLocalisableString("N0"),
date.ToLocalisableString("MMMM yyyy"));
2020-02-08 00:10:17 +03:00
}
}