Skip to content

ChartDataLabelsOptions/ChartDataLabelsDataset Does not work with complex data type #5144

Closed Answered by Eltee-Taiwo
Eltee-Taiwo asked this question in Q&A
Discussion options

You must be logged in to vote

#5146

readonly List<ChartDataLabelsDataset> _barDataLabelsDatasets = new()
{
    new()
    {
        DatasetIndex = 0,
        Options = new()
        {
            BackgroundColor = "#00ff00",
            BorderColor = "#00ff00",
            SoftCodeFormatter = "function(value, context) { return '£' + value.y; }"

        }
    },
    new ()
    {
        DatasetIndex = 1,
        Options = new ()
        {
            BackgroundColor = "Yellow",
            BorderColor = "Blue",
            SoftCodeFormatter = "function(value, context) { return '$' + value.y; }"
        }
    }
};

With the complex object looking like:

    public class DataPoint
    {
        public int Y { get; set; }

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@stsrki
Comment options

@stsrki
Comment options

@Eltee-Taiwo
Comment options

@Eltee-Taiwo
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Eltee-Taiwo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants