Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor apexchart data not in correct categories

$
0
0

I'm having issues regarding the use of categories with apexchart. The data is always mapping to the wrong category.I like to think I am missing something but I just can't seem to know what.

I'm trying to display data for one day, one column for each hour of the day.I want the user to be able to see all the available labels so I have resorted to using categories, one category for each hour ("11:00").So the list ends up beeing like this: ["00:00", "01:00", ...]Then I format the Datetime property of the data to this format with just .ToString("HH:00").

Now, if I apply the the list of categories to the XAxis options like so:

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

Then I get all the labels showing on the XAxis but the data goes into the wrong category.It goes into the first category available and so on.. but is does not match to the correct category.So if the list of data is [(1000, "09:00"), ...] then that first point will map to the first category "00:00" but not to the category "09:00"

I have tried having only Categories and/or only OverwriteCategories enabled but the data still goes into the wrong category.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>