This is a migrated thread and some comments may be shown as answers.

Formatting decimal to currency not working on series data

1 Answer 166 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
AJ
Top achievements
Rank 2
AJ asked on 12 Jun 2012, 06:32 PM
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?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 13 Jun 2012, 01:38 PM
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.
Tags
Chart (HTML5)
Asked by
AJ
Top achievements
Rank 2
Answers by
Marin Bratanov
Telerik team
Share this question
or