apexcharts / Blazor-ApexCharts

A blazor wrapper for ApexCharts.js
https://apexcharts.github.io/Blazor-ApexCharts
MIT License
794 stars 91 forks source link

Second x value always missing when XAxisType is DateTime #342

Closed JoeFarrera closed 6 months ago

JoeFarrera commented 10 months ago

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

@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; }
}

} `

joadan commented 10 months ago

Hello,

I believe this is the same as reported here, https://github.com/apexcharts/apexcharts.js/issues/4111

JoeFarrera commented 10 months ago

Yes it is. My apologies, should have seen that, thanks.

joadan commented 6 months ago

Fixed in apexcharts.js