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

ToolTip Formatting Issue

12 Answers 124 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Vinod Sardar
Top achievements
Rank 1
Vinod Sardar asked on 16 Dec 2009, 09:16 AM
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.

 

12 Answers, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 18 Dec 2009, 11:49 AM
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.
0
Vinod Sardar
Top achievements
Rank 1
answered on 18 Dec 2009, 11:56 AM
Thanks. It works.

thanks for providing me link. Link is very useful.


Thanks,
Vinod Sa.
0
Daniel Aquere
Top achievements
Rank 2
answered on 23 Apr 2011, 08:20 PM
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
0
Evgenia
Telerik team
answered on 27 Apr 2011, 03:28 PM
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
0
Daniel Aquere
Top achievements
Rank 2
answered on 28 Apr 2011, 02:08 PM
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
0
Daniel Aquere
Top achievements
Rank 2
answered on 02 May 2011, 09:47 PM
Hi everyone,

Please, some light about this issue...

Thanks,

Daniel
0
Evgenia
Telerik team
answered on 04 May 2011, 08:18 AM
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
0
Daniel Aquere
Top achievements
Rank 2
answered on 05 May 2011, 01:40 AM
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
0
Evgenia
Telerik team
answered on 10 May 2011, 01:57 PM
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
0
Daniel Aquere
Top achievements
Rank 2
answered on 11 May 2011, 03:56 AM
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
0
Evgenia
Telerik team
answered on 16 May 2011, 07:28 AM
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
0
Daniel Aquere
Top achievements
Rank 2
answered on 18 May 2011, 04:26 AM
Hi Evgenia,

Thanks for information, works very well.

Sorry for wrong post.

Best,

Daniel
Tags
Chart
Asked by
Vinod Sardar
Top achievements
Rank 1
Answers by
Ves
Telerik team
Vinod Sardar
Top achievements
Rank 1
Daniel Aquere
Top achievements
Rank 2
Evgenia
Telerik team
Share this question
or