Added MinViableWidth and MinViableHeight properties to control rendering
MODIFY
WalletWasabi.Fluent/Controls/LineChart.Properties.cs
WalletWasabi.Fluent/Controls/LineChart.Properties.cs
@@ -32,6 +32,12 @@ namespace WalletWasabi.Fluent.Controls
public static readonly StyledProperty<double> AreaStrokeMiterLimitProperty =
AvaloniaProperty.Register<LineChart, double>(nameof(AreaStrokeMiterLimit), 10.0);
+ public static readonly StyledProperty<double> AreaMinViableHeightProperty =
+ AvaloniaProperty.Register<LineChart, double>(nameof(AreaMinViableHeight), double.MinValue);
+
+ public static readonly StyledProperty<double> AreaMinViableWidthProperty =
+ AvaloniaProperty.Register<LineChart, double>(nameof(AreaMinViableWidth), double.MinValue);
+
// XAxis
public static readonly StyledProperty<List<double>?> XAxisValuesProperty =
@@ -55,6 +61,12 @@ namespace WalletWasabi.Fluent.Controls
public static readonly StyledProperty<double> XAxisArrowSizeProperty =
AvaloniaProperty.Register<LineChart, double>(nameof(XAxisArrowSize));
+ public static readonly StyledProperty<double> XAxisMinViableHeightProperty =
+ AvaloniaProperty.Register<LineChart, double>(nameof(XAxisMinViableHeight), double.MinValue);
+
+ public static readonly StyledProperty<double> XAxisMinViableWidthProperty =
+ AvaloniaProperty.Register<LineChart, double>(nameof(XAxisMinViableWidth), double.MinValue);
+
// XAxis Label
public static readonly StyledProperty<IBrush?> XAxisLabelForegroundProperty =
@@ -154,6 +166,12 @@ namespace WalletWasabi.Fluent.Controls
public static readonly StyledProperty<double> YAxisArrowSizeProperty =
AvaloniaProperty.Register<LineChart, double>(nameof(YAxisArrowSize));
+ public static readonly StyledProperty<double> YAxisMinViableHeightProperty =
+ AvaloniaProperty.Register<LineChart, double>(nameof(YAxisMinViableHeight), double.MinValue);
+
+ public static readonly StyledProperty<double> YAxisMinViableWidthProperty =
+ AvaloniaProperty.Register<LineChart, double>(nameof(YAxisMinViableWidth), double.MinValue);
+
// YAxis Title
public static readonly StyledProperty<string> YAxisTitleProperty =
@@ -352,6 +370,18 @@ namespace WalletWasabi.Fluent.Controls
set => SetValue(AreaStrokeMiterLimitProperty, value);
}
+ public double AreaMinViableHeight
+ {
+ get => GetValue(AreaMinViableHeightProperty);
+ set => SetValue(AreaMinViableHeightProperty, value);
+ }
+
+ public double AreaMinViableWidth
+ {
+ get => GetValue(AreaMinViableWidthProperty);
+ set => SetValue(AreaMinViableWidthProperty, value);
+ }
+
// XAxis
public double XAxisCurrentValue
@@ -414,6 +444,18 @@ namespace WalletWasabi.Fluent.Controls
set => SetValue(XAxisArrowSizeProperty, value);
}
+ public double XAxisMinViableHeight
+ {
+ get => GetValue(XAxisMinViableHeightProperty);
+ set => SetValue(XAxisMinViableHeightProperty, value);
+ }
+
+ public double XAxisMinViableWidth
+ {
+ get => GetValue(XAxisMinViableWidthProperty);
+ set => SetValue(XAxisMinViableWidthProperty, value);
+ }
+
// XAxis Label
public IBrush? XAxisLabelForeground
@@ -588,6 +630,18 @@ namespace WalletWasabi.Fluent.Controls
set => SetValue(YAxisArrowSizeProperty, value);
}
+ public double YAxisMinViableHeight
+ {
+ get => GetValue(YAxisMinViableHeightProperty);
+ set => SetValue(YAxisMinViableHeightProperty, value);
+ }
+
+ public double YAxisMinViableWidth
+ {
+ get => GetValue(YAxisMinViableWidthProperty);
+ set => SetValue(YAxisMinViableWidthProperty, value);
+ }
+
// YAxis Title
public string YAxisTitle

MODIFY
WalletWasabi.Fluent/Controls/LineChart.cs
WalletWasabi.Fluent/Controls/LineChart.cs
@@ -219,7 +219,10 @@ namespace WalletWasabi.Fluent.Controls
return;
}
- if (state.AreaWidth <= 0 || state.AreaHeight <= 0)
+ if (state.AreaWidth <= 0
+ || state.AreaHeight <= 0
+ || state.AreaWidth < AreaMinViableWidth
+ || state.AreaHeight < AreaMinViableHeight)
{
return;
}
@@ -247,7 +250,10 @@ namespace WalletWasabi.Fluent.Controls
return;
}
- if (state.AreaWidth <= 0 || state.AreaHeight <= 0)
+ if (state.AreaWidth <= 0
+ || state.AreaHeight <= 0
+ || state.AreaWidth < AreaMinViableWidth
+ || state.AreaHeight < AreaMinViableHeight)
{
return;
}
@@ -306,7 +312,10 @@ namespace WalletWasabi.Fluent.Controls
return;
}
- if (state.AreaWidth <= 0 || state.AreaHeight <= 0)
+ if (state.AreaWidth <= 0
+ || state.AreaHeight <= 0
+ || state.AreaWidth < XAxisMinViableWidth
+ || state.AreaHeight < XAxisMinViableHeight)
{
return;
}
@@ -394,7 +403,10 @@ namespace WalletWasabi.Fluent.Controls
return;
}
- if (state.AreaWidth <= 0 || state.AreaHeight <= 0)
+ if (state.AreaWidth <= 0
+ || state.AreaHeight <= 0
+ || state.AreaWidth < YAxisMinViableWidth
+ || state.AreaHeight < YAxisMinViableHeight)
{
return;
}
@@ -430,7 +442,10 @@ namespace WalletWasabi.Fluent.Controls
return;
}
- if (state.AreaWidth <= 0 || state.AreaHeight <= 0)
+ if (state.AreaWidth <= 0
+ || state.AreaHeight <= 0
+ || state.AreaWidth < YAxisMinViableWidth
+ || state.AreaHeight < YAxisMinViableHeight)
{
return;
}

MODIFY
WalletWasabi.Fluent/Views/TestLineChartView.axaml
WalletWasabi.Fluent/Views/TestLineChartView.axaml
<Setter Property="XAxisStroke" Value="{DynamicResource TextForegroundColor}" />
<Setter Property="XAxisStrokeThickness" Value="0.7" />
<Setter Property="XAxisArrowSize" Value="3.5" />
+ <Setter Property="XAxisMinViableWidth" Value="0"/>
+ <Setter Property="XAxisMinViableHeight" Value="0"/>
</Style>
<!-- LineChart YAxis -->
<Style Selector="c|LineChart.yAxis">
<Setter Property="YAxisStroke" Value="{DynamicResource TextForegroundColor}" />
<Setter Property="YAxisStrokeThickness" Value="0.7" />
<Setter Property="YAxisArrowSize" Value="3.5" />
+ <Setter Property="YAxisMinViableWidth" Value="0"/>
+ <Setter Property="YAxisMinViableHeight" Value="140"/>
</Style>
<!-- LineChart YAxis Title -->
<Style Selector="c|LineChart.yAxisTitle">
AreaMargin="30,40,30,30"
AreaStrokeThickness="2"
AreaStrokeLineCap="Round"
+ AreaMinViableWidth="0"
+ AreaMinViableHeight="0"
YAxisTitle="More Expensive">
<c:LineChart.AreaFill>
<LinearGradientBrush StartPoint="50%,0%" EndPoint="50%,100%" Opacity="0.2">

Added MinViableWidth and MinViableHeight properties to control rendering