Skip to content
Snippets Groups Projects
Commit 9673d890 authored by Philipp Müller's avatar Philipp Müller
Browse files

added correct styles for the statistics screen

- added END button to statistics screen
parent b8a9d76a
No related branches found
No related tags found
1 merge request!52added correct styles for the statistics screen
......@@ -107,7 +107,7 @@ namespace InnoLabProjektDektopApp
{
timer.Stop();
string jsonpath = ((ProcessMonitor)sender).lastSessionInfoFilePath;
NavigateTo(new SessionStatistics(jsonpath));
NavigationService.Navigate(new SessionStatistics(jsonpath));
MessageBox.Show("All sessions completed!", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
}
......@@ -325,11 +325,6 @@ namespace InnoLabProjektDektopApp
StageText.Text = ProcessMonitor.tmpStage.ToString();
}
public void NavigateTo(Object page)
{
this.NavigationService.Navigate(page);
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
this.NavigationService.Navigate(new Distractions());
......
......@@ -7,20 +7,46 @@
xmlns:header="clr-namespace:InnoLabProjektDektopApp.Screens.Templates"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
mc:Ignorable="d"
Height="550" Width="900"
Title="SessionStatistics">
Title="SessionStatistics"
Background="{StaticResource BACKGROUND_PRIMARY_BRUSH}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Canvas Name="chartCanvas" Margin="50" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Canvas Grid.Row="0" Grid.ColumnSpan="2" Background="{StaticResource HIGHLIGHT_PRIMARY_BRUSH}">
<TextBlock Margin="135,40" Text="End of your focus session"
FontSize="42" FontWeight="Bold" HorizontalAlignment="Left"/>
</Canvas>
<Canvas Name="chartCanvas" Margin="150" Grid.Row="1" Grid.Column="0"
HorizontalAlignment="Left" VerticalAlignment="Top">
<Rectangle x:Name="chartBackground" Width="480" Height="150" Fill="#333436" RadiusX="10" RadiusY="10" Margin="-15,-25" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<TextBlock Text="Your session overview" FontSize="32" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,-25"/>
</Canvas>
<Grid Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Top" Width="350" Height="350">
<Image Source="{Binding CenterImageSource}" Width="200" Height="200" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<lvc:PieChart Series="{Binding Series}" />
<Grid Grid.Row="1" Grid.Column="1" Margin="100" HorizontalAlignment="Right"
VerticalAlignment="Top" Width="350" Height="350">
<Image Source="{Binding CenterImageSource}" Width="200" Height="200"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<lvc:PieChart Series="{Binding Series}" Width="350" Height="350"/>
</Grid>
<Border Grid.Row="1" Grid.Column="0" Margin="135,0,0,40" Style="{StaticResource RoundedButtonBorder}"
MouseDown="Button_Click" HorizontalAlignment="Left" VerticalAlignment="Bottom">
<TextBlock Text="End" Style="{StaticResource ButtonTextStyle}" />
</Border>
</Grid>
</Page>
......@@ -53,6 +53,11 @@ namespace InnoLabProjektDektopApp.Screens.Regulaer
UpdateSeriesValues();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Overview());
}
private void DrawChart(string json_file_path)
{
// Example JSON data
......@@ -71,6 +76,10 @@ namespace InnoLabProjektDektopApp.Screens.Regulaer
}
final_stage = sessionData.FinalDistractionStage;
// Calculate the height of the rectangle
int rectangleHeight = 190 + (int)(1.5 * bar_height * (sessionData.CycleStartTimes.Count-1));
chartBackground.Height = rectangleHeight;
// Draw bars for each cycle
foreach (var cycle in sessionData.CycleStartTimes)
{
......@@ -99,7 +108,7 @@ namespace InnoLabProjektDektopApp.Screens.Regulaer
TextBlock cycleText = new()
{
Text = $"Cycle {cycle.Key}",
Foreground = Brushes.Black,
Foreground = Brushes.White,
FontSize = 15,
FontWeight = FontWeight.FromOpenTypeWeight(500)
};
......@@ -181,7 +190,7 @@ namespace InnoLabProjektDektopApp.Screens.Regulaer
Y1 = offset - 5,
X2 = 0,
Y2 = 1.5 * 20 * (sessionData.CycleStartTimes.Count) + offset - 5,
Stroke = Brushes.Black,
Stroke = Brushes.White,
StrokeThickness = 2
};
Canvas.SetTop(yAxis, 0);
......@@ -214,12 +223,12 @@ namespace InnoLabProjektDektopApp.Screens.Regulaer
{
// Create legend items
var legendItems = new List<(string Text, Brush Color)>
{
("Productive Work", Brushes.Green),
("Distraction", Brushes.Red),
("Break", Brushes.Blue),
("Pause", Brushes.LightBlue)
};
{
("Productive Work", Brushes.Green),
("Distraction", Brushes.Red),
("Break", Brushes.Blue),
("Pause", Brushes.LightBlue)
};
// Draw legend
for (int i = 0; i < legendItems.Count; i++)
......@@ -241,7 +250,7 @@ namespace InnoLabProjektDektopApp.Screens.Regulaer
TextBlock legendText = new()
{
Text = legendItem.Text,
Foreground = Brushes.Black,
Foreground = Brushes.White,
FontSize = 20
};
legendText.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
......@@ -271,33 +280,33 @@ namespace InnoLabProjektDektopApp.Screens.Regulaer
Series =
[
new PieSeries<double> {
Name = $"Distractions:",
Values = distractedTime.TotalSeconds > 1 ? [distractedTime.TotalMinutes] : new List<double>(),
MaxRadialColumnWidth = 50,
Fill = new SolidColorPaint(SKColors.Red),
ToolTipLabelFormatter = value => $"{distractedTimeFormatted} minutes"
},
new PieSeries<double> {
Name = $"Breaks:",
Values = breakTime.TotalSeconds > 1 ? [breakTime.TotalMinutes] : new List<double>(),
MaxRadialColumnWidth = 50,
Fill = new SolidColorPaint(SKColors.Blue),
ToolTipLabelFormatter = value => $"{breakTimeFormatted} minutes"
},
new PieSeries<double> {
Name = $"Manually paused:",
Values = pausedTime.TotalSeconds > 1 ? [pausedTime.TotalMinutes] : new List<double>(),
MaxRadialColumnWidth = 50,
Fill = new SolidColorPaint(SKColors.LightBlue),
ToolTipLabelFormatter = value => $"{pausedTimeFormatted} minutes"
},
new PieSeries<double> {
Name = $"Productive:",
Values = productiveTime.TotalSeconds > 1 ? [productiveTime.TotalMinutes] : new List<double>(),
MaxRadialColumnWidth = 50,
Fill = new SolidColorPaint(SKColors.Green),
ToolTipLabelFormatter = value => $"{productiveTimeFormatted} minutes"
}
Name = $"Distractions:",
Values = distractedTime.TotalSeconds > 1 ? [distractedTime.TotalMinutes] : new List<double>(),
MaxRadialColumnWidth = 50,
Fill = new SolidColorPaint(SKColors.Red),
ToolTipLabelFormatter = value => $"{distractedTimeFormatted} minutes"
},
new PieSeries<double> {
Name = $"Breaks:",
Values = breakTime.TotalSeconds > 1 ? [breakTime.TotalMinutes] : new List<double>(),
MaxRadialColumnWidth = 50,
Fill = new SolidColorPaint(SKColors.Blue),
ToolTipLabelFormatter = value => $"{breakTimeFormatted} minutes"
},
new PieSeries<double> {
Name = $"Manually paused:",
Values = pausedTime.TotalSeconds > 1 ? [pausedTime.TotalMinutes] : new List<double>(),
MaxRadialColumnWidth = 50,
Fill = new SolidColorPaint(SKColors.LightBlue),
ToolTipLabelFormatter = value => $"{pausedTimeFormatted} minutes"
},
new PieSeries<double> {
Name = $"Productive:",
Values = productiveTime.TotalSeconds > 1 ? [productiveTime.TotalMinutes] : new List<double>(),
MaxRadialColumnWidth = 50,
Fill = new SolidColorPaint(SKColors.Green),
ToolTipLabelFormatter = value => $"{productiveTimeFormatted} minutes"
}
];
CenterImageSource = new BitmapImage(new Uri($"pack://application:,,,/Assets/MascottAnimation/Up/{final_stage}/frame0.png"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment