mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-02-04 05:35:44 +00:00
Chart 0 at beginning and end of x-axis
This commit is contained in:
@@ -10,7 +10,18 @@ namespace Radzen.Blazor
|
||||
|
||||
public override object Value(double value)
|
||||
{
|
||||
return Data?.ElementAtOrDefault(Convert.ToInt32(value)) ?? default(int);
|
||||
if (Data == null)
|
||||
{
|
||||
return default!;
|
||||
}
|
||||
|
||||
var index = Convert.ToInt32(value);
|
||||
if (index < 0 || index >= Data.Count)
|
||||
{
|
||||
return default!;
|
||||
}
|
||||
|
||||
return Data[index];
|
||||
}
|
||||
|
||||
public override (double Start, double End, double Step) Ticks(int distance)
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
<Line class="rz-line" X1="@x1" Y1="@y1" X2="@x2" Y2="@y1" Stroke="@(XAxis?.Stroke)" StrokeWidth="@(XAxis?.StrokeWidth ?? 0)" LineType="@(XAxis?.LineType ?? LineType.Solid)" />
|
||||
@for (var idx = start; idx <= end; idx += step)
|
||||
{
|
||||
var value = Chart?.CategoryScale?.Value((double)idx) ?? 0;
|
||||
var value = Chart?.CategoryScale?.Value((double)idx);
|
||||
var x = Chart?.CategoryScale?.Scale((double)idx, true) ?? 0;
|
||||
|
||||
var text = XAxis != null && Chart?.CategoryScale != null ? XAxis.Format(Chart.CategoryScale, value) : "";
|
||||
var text = value != null && XAxis != null && Chart?.CategoryScale != null ? XAxis.Format(Chart.CategoryScale, value) : "";
|
||||
|
||||
if (XAxis?.Ticks?.Template != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user