Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Categories not mapping to correct categories #473

Open
RagnarSmari opened this issue Jun 11, 2024 · 0 comments
Open

Categories not mapping to correct categories #473

RagnarSmari opened this issue Jun 11, 2024 · 0 comments

Comments

@RagnarSmari
Copy link

I'm making a graph where on the XAxis there is category for each hour of the day.
Then I format the XPoint on the data to be the same as the category but the data still goes into the wrong category when displayed.
I create a list for all the categories and apply it:

 private List<string> _categories = Enumerable.Range(0, 24).Select(x => _from.AddHours(x).ToString("HH:00")).ToList();
        _options.Xaxis = new XAxis
        {
            Title = new AxisTitle
            {
                Text = ClientTranslations.Time
            },
            Categories = _categories
        };


    <ApexChart @ref="_chart" TItem="MyData"
               Options="_options"
               Height="500"
               Debug="true">

        @foreach (var series in _graphData)
        {
            <ApexPointSeries TItem="MyData"
                             Items="@series.Data"
                             Name="@series.Name"
                             XValue="@(x => x.CreatedAt.ToString("HH:00"))"
                             YAggregate="@(x => x.Sum(x => x.Weight))"
                             SeriesType="SeriesType.Bar"/>
        }
    </ApexChart>

This will display in the debugger as:
image

But the data is in the wrong category as we can see on the chart:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant