Formatting decimal to currency not working on series data

2 posts, 0 answers
  1. AJ
    AJ avatar
    33 posts
    Member since:
    Jun 2011

    Posted 12 Jun 2012 Link to this post

    I understand this is a relatively new product, but I'm running into a pretty odd issue with the chart not formatting decimal values from a Typed List into currency.

    Here is what's on the front-end. Note, that for the DataFormatString in the Series' Label and Tooltip Appearance I've tried ${0}, {0:C}, ${0:0.00}, and a multitude of other options. However, it would show the entire decimal value (rather than rounding up on the last two digits) (see attached). What's interesting is that the Y-Axis label comes up perfectly fine.

    This is what generates the data for the chart:

    var qry = _ctx.VSalesRepCommissionGroupeds
        .Where(s => s.SurgeryDate.Value >= RadCommissionChartBeginOn)
        .OrderBy(s => s.SurgeryDate.Value)
        .Select(r => new
        {
            r.CommissionDue,
            SurgeryDate = r.SurgeryDate.Value.ToString("MMM yyyy")
        }).ToList();
     
    radData = qry.GroupBy(r => r.SurgeryDate).Select(r => new RepCommissionChartData
    {
        Commissions = r.Sum(x => x.CommissionDue),
        SurgeryDate = r.Key
    }).ToList();


    Now, if I change the line that generates the sum of CommissionDue to decimal.Round(r.Sum(x => x.CommissionDue), 2, MidpointRounding.AwayFromZero) it obviously rounds up the first two digits, but doesn't show a comma.

    Shouldn't the front end format it using either of those formatting options or am I doing something wrong?
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 13 Jun 2012 Link to this post

    Hi AJ,

    Thank you for pointing our attention to this. I have logged this bug for research and you can monitor its progress in this URL. I have also updated your Telerik points as a token of gratitude for your assistance and patience.


    Greetings,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top