ToolTip Formatting Issue

13 posts, 1 answers
  1. Vinod Sardar
    Vinod Sardar avatar
    33 posts
    Member since:
    Nov 2009

    Posted 16 Dec 2009 Link to this post

    hi,

    I am creating a sample chart and I wanted a tooltip to be display on it.

    I have X -Axis (DateTime) and Y-Axis (Double) value.

    I am using following code for tooltip:

    ItemToolTipFormat = XAxisPropertyName +

    ":#XCAT{d}" + "\r\n" + YAxisPropertyName + ":#Y";
    where XAxisPropertyName is the name of the X-Axis and YAxisPropertyName is the name of the Y Axis.

    I am using {d} for formatting but still tooltip shows the "1/1/194 12:00:00" for DateTime part... It include the time which I don;t want.
    how do i set the tooltip formatting for Datetime and other type like Double where I may want to display number of decimal places.?

    Thanks,
    Vinod Sa.

     

  2. Answer
    Ves
    Admin
    Ves avatar
    2879 posts

    Posted 18 Dec 2009 Link to this post

    Hi Vinod,

    The "#XCAT" token already represents a string, so it cannot be further formatted. Still, you can retrieve the date from the underlying object using the "#DATAITEM.<PropertyName>" token (ex. "#DATAITEM.DateReceived{d}". You can find more information here.
     
    Best regards,
    Ves
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Vinod Sardar
    Vinod Sardar avatar
    33 posts
    Member since:
    Nov 2009

    Posted 18 Dec 2009 Link to this post

    Thanks. It works.

    thanks for providing me link. Link is very useful.


    Thanks,
    Vinod Sa.
  5. Daniel Aquere
    Daniel Aquere avatar
    85 posts
    Member since:
    Mar 2011

    Posted 23 Apr 2011 Link to this post

    Hello Everyone,

    Please, I need to format my tooltips with currency format ("#Y{C}"), but, I don´t know where put the configuration. Actually appears 123456, I´d like 1.234,56.

    i apreciate any help.

    Thanks, best

    Daniel
  6. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 27 Apr 2011 Link to this post

    Hi Daniel,

    RadChart allows you to specify how to format the labels by the ChartArea.LabelFormatBehavior property as described in our help topic. By default it is set to HumanReadable. If you set it to None the numbers will be shown according to your Culture (with two or more delimiters):

    RadChart1.DefaultView.ChartArea.LabelFormatBehavior = LabelFormatBehavior.None;
    NOTE that changing the LabelsFormatBehavior will affect the whole ChartArea (the Axes, the Series, theToltips and etc.)

    I hope this helps.

    All the best,
    Evgenia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Daniel Aquere
    Daniel Aquere avatar
    85 posts
    Member since:
    Mar 2011

    Posted 28 Apr 2011 Link to this post

    Hi Evgenia,

    Hope this finds you well.

    Your tip is very usefull. One last point, please, I tried apply this parameter in codebehing, but, it´s not recognized, specially "DefaultView".

    Please, where I need to apply this configuration?

    Thanks, abraço

    Daniel
  8. Daniel Aquere
    Daniel Aquere avatar
    85 posts
    Member since:
    Mar 2011

    Posted 02 May 2011 Link to this post

    Hi everyone,

    Please, some light about this issue...

    Thanks,

    Daniel
  9. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 04 May 2011 Link to this post

    Hi Daniel,

    Let me start with my apologies for the late reply. As reading carefully your requirement now I realise that you want to set Currency as format for your Tooltips and as well to change the way the values appear (123456 -> 1.234,56).
    Since there is no way to set two formats for one and the same value at same time using the ItemTooltipFormat property, what I can suggest is that you handle the ItemTooltipOpening event and set the formats there before applying the content to the tooltip. For more information you can refer to our help topic.

    Regards,
    Evgenia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Daniel Aquere
    Daniel Aquere avatar
    85 posts
    Member since:
    Mar 2011

    Posted 04 May 2011 Link to this post

    Hi Evgenia,

    I really appreciate your help, but I´m new with Telerik controls and I could not apply your suggestion, probably because I don´t have experience with Telerik controls.

    In true, I´m a little surprise because aparently is a simple feature to have in charts and is necessary specially configurations to have the expected result.

    Thanks, best

    Daniel
  11. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 10 May 2011 Link to this post

    Hi Daniel,

    Here is how to achieve the desired formatting (123456 -> 1.234,56 $):
    Handle the ItemDataBound event of the Chart and set the following format for the tooltips:

    void RadChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
            {
                CultureInfo original = new CultureInfo("en-US");
      
                NumberFormatInfo format = (NumberFormatInfo)original.NumberFormat.Clone();
                format.CurrencyDecimalSeparator = ",";
                format.CurrencyGroupSeparator = ".";
                format.CurrencyPositivePattern = 1;
                e.DataPoint.Tooltip = e.DataPoint.YValue.ToString("C", format);
            }

    Note that by default in American culture the $ sign appears before the number (shown here), the CurrencyDecimalSeparator is "." and the CurrencyGroupSeparator is ",". By  making a clone of the culture I'm specifying these properties as I want. If you like you can change the $ sign with whatever CurrencySymbol you like.

    I hope this helps.

    Kind regards,
    Evgenia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  12. Daniel Aquere
    Daniel Aquere avatar
    85 posts
    Member since:
    Mar 2011

    Posted 10 May 2011 Link to this post

    Hi Evgenia,

    Hope this finds you well.

    I´m trying to use your suggestion, but, in this line:
    e.DataPoint.Tooltip = e.DataPoint.YValue.ToString("C", format);

    I receive this error message:
    'Telerik.Charting.ChartItemDataBoundEventArgs' does not contain a definition for 'DataPoint' and no extension method 'DataPoint' accepting a first argument of type 'Telerik.Charting.ChartItemDataBoundEventArgs' could be found (are you missing a using directive or an assembly reference?)

    I´m using asp.net ajax. Can this command to apply in this scenario?

    Thanks for your help.

    Best

    Daniel
  13. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 16 May 2011 Link to this post

    Hi Daniel,

    Since this thread is related to RadChart for Silverlight, all my posts up to now were for this technology.
    To be able to achieve this formatting in RadChart for ASP.NET AJAX you can handle the same event (ItemDataBound) but instead of DataPoint in the eventargs you'll have to use the SeriesItem. Here is how to do this:

    void RadChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
       {
           CultureInfo original = new CultureInfo("en-US"); 
       
               NumberFormatInfo format = (NumberFormatInfo)original.NumberFormat.Clone(); 
               format.CurrencyDecimalSeparator = ","; 
               format.CurrencyGroupSeparator = "."; 
               format.CurrencyPositivePattern = 1;
               e.SeriesItem.ActiveRegion.Tooltip = e.SeriesItem.YValue.ToString("C", format);
       }

    Please keep the content of the posts related to the Product of the forum, so that it is easier for both sides to follow it.

    Kind regards,
    Evgenia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  14. Daniel Aquere
    Daniel Aquere avatar
    85 posts
    Member since:
    Mar 2011

    Posted 17 May 2011 Link to this post

    Hi Evgenia,

    Thanks for information, works very well.

    Sorry for wrong post.

    Best,

    Daniel
Back to Top
DevCraft banner