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

feat: add X Axis Label Formatter #462

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

fabio-sp
Copy link

Summary

This PR adds the possibility to format X Axis labels using .NET (as users can already done with Y Axis Labels using the FormatYAxisLabel parameter of the ApexChart component).

This is particularly useful in those cases when using horizontal bar charts.

<ApexChart TItem="Order"
               Title="Order Net Value"
               FormatXAxisLabel="GetXAxisLabel"
               Options="options">
@* ... *@
</ApexChart>

@code
{

// ...

    private string GetXAxisLabel(decimal value)
    {
        return "$" + value.ToString("N0");
    }

// ...
}

Screenshots

image

Things to consider

This does not address a problem on the values shown in the tooltip shown on mouse hover; as far as I know, it looks like the problem is not related to the Blazor wrapper implementation but to the underlying Apex Charts Js library. An issues already exists for this: apexcharts/apexcharts.js#4472

@joadan
Copy link
Member

joadan commented Jun 13, 2024

Thank you!

@joadan joadan merged commit c2517d3 into apexcharts:master Jun 13, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants