mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-07-08 18:16:08 +00:00
Sets the width of the axis in pixels. If not specified, the width is calculated automatically. Setting a fixed width can help reduce unnecessary spacing when using multiple Y-axes.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Radzen.Blazor
|
||||
{
|
||||
@@ -82,6 +82,12 @@ namespace Radzen.Blazor
|
||||
[Parameter]
|
||||
public int TickDistance { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the width of the axis in pixels. If not set, the width is calculated automatically based on the axis content.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public int? Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the minimum value of the axis.
|
||||
/// </summary>
|
||||
@@ -141,7 +147,7 @@ namespace Radzen.Blazor
|
||||
[Parameter]
|
||||
public object? CrossesAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Specifies the label rotation angle in degrees. Set to <c>null</c> by default which means no rotation is applied. Has higher precedence than <see cref="LabelAutoRotation"/>.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
@inherits AxisBase
|
||||
<CascadingValue Value="@this">
|
||||
@ChildContent
|
||||
@ChildContent
|
||||
</CascadingValue>
|
||||
@code {
|
||||
[Parameter]
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
return AxisMeasurer.YAxis(chart.ValueScale, chart.ValueAxis, Title);
|
||||
return AxisMeasurer.YAxis(chart.ValueScale, this, Title);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Radzen.Blazor.Rendering
|
||||
{
|
||||
@@ -22,6 +20,12 @@ namespace Radzen.Blazor.Rendering
|
||||
ArgumentNullException.ThrowIfNull(axis);
|
||||
ArgumentNullException.ThrowIfNull(title);
|
||||
|
||||
//We can use the axis width if it is set, otherwise we need to calculate the width based on the ticks and title
|
||||
if (axis.Width.HasValue)
|
||||
{
|
||||
return axis.Width.Value;
|
||||
}
|
||||
|
||||
var ticks = scale.Ticks(axis.TickDistance);
|
||||
|
||||
double length = 0;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<RadzenAxisTitle Text="Revenue ($)" />
|
||||
<RadzenGridLines Visible="true" />
|
||||
</RadzenValueAxis>
|
||||
<RadzenValueAxis Name="orders">
|
||||
<RadzenValueAxis Width="50" Name="orders">
|
||||
<RadzenAxisTitle Text="Order Count" />
|
||||
</RadzenValueAxis>
|
||||
<RadzenLegend Position="LegendPosition.Bottom" />
|
||||
|
||||
Reference in New Issue
Block a user