mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Apply colors to charts.
This commit is contained in:
@@ -64,7 +64,10 @@ public partial class Commands
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _commandsCounts
|
||||
Data = _commandsCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
using Blazorise.Charts;
|
||||
|
||||
namespace Aaru.Server.Components.Pages.Statistics;
|
||||
|
||||
public static class Common
|
||||
{
|
||||
internal static readonly List<string> BackgroundColors =
|
||||
internal static List<string> BackgroundColors =
|
||||
[
|
||||
ChartColor.FromHtmlColorCode("#006412"), ChartColor.FromHtmlColorCode("#0000D3"), ChartColor.FromHtmlColorCode("#FF6403"), ChartColor.FromHtmlColorCode("#562C05"), ChartColor.FromHtmlColorCode("#DD0907"), ChartColor.FromHtmlColorCode("#F20884"), ChartColor.FromHtmlColorCode("#4700A5"), ChartColor.FromHtmlColorCode("#90713A"), ChartColor.FromHtmlColorCode("#1FB714"), ChartColor.FromHtmlColorCode("#02ABEA"), ChartColor.FromHtmlColorCode("#FBF305")
|
||||
"#006412", "#0000D3", "#FF6403", "#562C05", "#DD0907", "#F20884", "#4700A5", "#90713A", "#1FB714",
|
||||
"#02ABEA", "#FBF305"
|
||||
];
|
||||
internal static readonly List<string> BorderColors = [ChartColor.FromHtmlColorCode("#8b0000")];
|
||||
|
||||
internal static async Task HandleRedrawAsync<TDataSet, TItem, TOptions, TModel>(BaseChart<TDataSet, TItem, TOptions, TModel> chart, string[] labels, Func<TDataSet> getDataSet)
|
||||
where TDataSet : ChartDataset<TItem> where TOptions : ChartOptions where TModel : ChartModel
|
||||
{
|
||||
await chart.Clear();
|
||||
|
||||
await chart.AddLabelsDatasetsAndUpdate(labels, getDataSet()).ConfigureAwait(false);
|
||||
}
|
||||
internal static List<string>? BorderColors = ["#8b0000"];
|
||||
}
|
||||
@@ -121,7 +121,10 @@ public partial class Devices
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _devicesByBusCounts
|
||||
Data = _devicesByBusCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -145,7 +148,10 @@ public partial class Devices
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _devicesByManufacturerCounts
|
||||
Data = _devicesByManufacturerCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -63,7 +63,10 @@ public partial class Filesystems
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _filesystemsCounts
|
||||
Data = _filesystemsCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -63,7 +63,10 @@ public partial class Filters
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _filtersCounts
|
||||
Data = _filtersCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -63,7 +63,10 @@ public partial class Formats
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _formatsCounts
|
||||
Data = _formatsCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -158,7 +158,10 @@ public partial class OperatingSystems
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _operatingSystemsCounts
|
||||
Data = _operatingSystemsCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -180,7 +183,10 @@ public partial class OperatingSystems
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _linuxCounts
|
||||
Data = _linuxCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -202,7 +208,10 @@ public partial class OperatingSystems
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _macosCounts
|
||||
Data = _macosCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -224,7 +233,10 @@ public partial class OperatingSystems
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _windowsCounts
|
||||
Data = _windowsCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -63,7 +63,10 @@ public partial class Partitions
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _partitionsCounts
|
||||
Data = _partitionsCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -98,7 +98,10 @@ public partial class RealMedias
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _realMediaCounts
|
||||
Data = _realMediaCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -69,7 +69,10 @@ public partial class Versions
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _versionsCounts
|
||||
Data = _versionsCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -98,7 +98,10 @@ public partial class VirtualMedias
|
||||
[
|
||||
new PieChartDataset
|
||||
{
|
||||
Data = _virtualMediaCounts
|
||||
Data = _virtualMediaCounts,
|
||||
BackgroundColor = Common.BackgroundColors,
|
||||
BorderColor = Common.BorderColors,
|
||||
BorderWidth = [1]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user