Skip to content

Second x value always missing when XAxisType is DateTime #342

@JoeFarrera

Description

@JoeFarrera

Versión 2.1.0

On a bar chart with XAxisType as Datetime, the second value is skipped. The tooltip has the correct value for the x-axis position as shown in the screen capture.

If the zoom is changed, on occasions the missing bar appears, but by default it is always missing.

I can see no errors on the (Chrome) browser console.

Code below.

BlazorAjaxChartDateTime

`@page "/GraphTest"

Graph

    <ApexPointSeries TItem="MyData"
                     Items="Data"
                     Name="Some Value"
                     SeriesType="SeriesType.Bar"
                     XValue="e => e.DiaHora"
                     YValue="e=> e.SomeValue" /> 

</ApexChart>

@code {
private List Data { get; set; } = new();
private ApexChartOptions ChartOptions { get; set; } = new();
protected override void OnInitialized()
{

    DateTime startTime = DateTime.Now;
    DateTime startOfHour = new DateTime(startTime.Year, startTime.Month, startTime.Day, startTime.Hour, 0, 0, 0);
    Random rnd = new Random();
    for (int i = 0; i < 4; i++)
    {
        Data.Add(new MyData { SomeValue = rnd.Next(1, 11), DiaHora = startOfHour.AddHours(i) });
    }

    ChartOptions.Xaxis = new XAxis
        {
            Type = XAxisType.Datetime,
            Labels = new XAxisLabels
            {
                DatetimeUTC = false,
                RotateAlways = false,
            }
        };

    ChartOptions.Tooltip = new ApexCharts.Tooltip
        {

            X = new TooltipX
            {
                Format = "HH:mm"
            }
        };
}

public class MyData
{

    public DateTime? DiaHora { get; set; }
    public int SomeValue { get; set; }
}

}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions