Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

label formatting

Last post 06-26-2008 15:09 by [Infragistics] David Negley. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-19-2008 10:35

    • cgoodman
    • Top 200 Contributor
    • Joined on 05-06-2008
    • Points 335

    label formatting

    I am using version 8.1... 

    I have created a radial gauge that will have three tic marks.  The gauge is on the small side, and some of the numbers I will be using are quite large.  I need to be able to format the tick mark labels like so...  If i have a number like 85,565,000, then it needs to be formatted as $85.565 M where M stands for millions... you probably figured that out.  I have the routine to either return the formatted numbers, or return the format, but I cannot figure out how to get this format on the gauge.

    Currently I am using gauge.Scales[0].Labels.FormatString = "<DATA_VALUE:$###,###,###,##0>"; and this seems to work fine if I could make the gauge big enough to fit the numbers.

    The main problem is that this needs to be dynamic.  I could have three values of 0; 500,000; and 1,000,000 (just for ease sake) and I want the labels to show as $0, $500 K, $1 M after being formatted, which is why I wrote my own format routine.  How can I apply dynamic formatting to the labels?

    • Post Points: 20
  • 06-26-2008 15:09 In reply to

    Re: label formatting

     private void ultraGauge1_RenderLabel(object sender, RenderLabelEventArgs e)
    {
        double numericValue;
        if (double.TryParse(e.Text, out numericValue))
        {
            // your number formatting logic goes here
            if (numericValue >= 1000000)
            {
                e.Text = "millions";
            }
            else if (numericValue >= 1000)
            {
                e.Text = "thousands";
            }
        }
    }

    • Post Points: 5
Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems