Make UserHistoryGraph non-abstract

This commit is contained in:
Andrei Zavatski
2020-03-10 00:50:12 +03:00
parent f6461dc5f8
commit 2f441baeac
4 changed files with 24 additions and 22 deletions

View File

@ -8,15 +8,22 @@ using static osu.Game.Users.User;
namespace osu.Game.Overlays.Profile.Sections.Historical
{
public abstract class UserHistoryGraph : UserGraph<DateTime, long>
public class UserHistoryGraph : UserGraph<DateTime, long>
{
public UserHistoryCount[] Values
{
set => Data = value?.Select(v => new KeyValuePair<DateTime, long>(v.Date, v.Count)).ToArray();
}
/// <summary>
/// Text describing the value being plotted on the graph, which will be displayed as a prefix to the value in the <see cref="HistoryGraphTooltip"/>
/// </summary>
public string TooltipCounterName { get; set; } = @"Plays";
protected override float GetDataPointHeight(long playCount) => playCount;
protected override UserGraphTooltip GetTooltip() => new HistoryGraphTooltip(TooltipCounterName);
protected override object GetTooltipContent(DateTime date, long playCount)
{
return new TooltipDisplayContent
@ -26,8 +33,13 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
};
}
protected abstract class HistoryGraphTooltip : UserGraphTooltip
protected class HistoryGraphTooltip : UserGraphTooltip
{
public HistoryGraphTooltip(string tooltipCounterName)
: base(tooltipCounterName)
{
}
public override bool SetContent(object content)
{
if (!(content is TooltipDisplayContent info))