Danny Scheelings
Top achievements
Rank 1
Danny Scheelings
asked on 05 Aug 2010, 11:51 AM
Hello,
I have to create a chart where the labels on x-axis are very long. So I will provide a shortened name in the ItemsSource to show as the X-axis labels, but I want to show the long name as a tooltip on the X-axis labels.
Is this possible?
Thanks,
Danny
I have to create a chart where the labels on x-axis are very long. So I will provide a shortened name in the ItemsSource to show as the X-axis labels, but I want to show the long name as a tooltip on the X-axis labels.
Is this possible?
Thanks,
Danny
12 Answers, 1 is accepted
0
Hi Danny,
One possible option in this case would be to attach to the DataBound event handler of the Chart control, and loop through the labels to set the desired text. This may look like this:
Regards,
Yavor
the Telerik team
One possible option in this case would be to attach to the DataBound event handler of the Chart control, and loop through the labels to set the desired text. This may look like this:
telerikChart.DefaultView.ChartArea.AxisX.TickPoints[0].Label = "CustomLabel1";
I hope this gets you started properly.Regards,
Yavor
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
Danny Scheelings
Top achievements
Rank 1
answered on 30 Aug 2010, 08:12 AM
Hi Yavor,
Thanks for your reply.
This way only the text of the tickpoints can be changed. But I want to set a tooltip on a tickpoint. I tried the code below but that does not compile:
Is there a way to set a tooltip on the tickpoint?
Thanks,
Danny
Thanks for your reply.
This way only the text of the tickpoints can be changed. But I want to set a tooltip on a tickpoint. I tried the code below but that does not compile:
void
chart_DataBound(
object
sender, ChartDataBoundEventArgs e)
{
foreach
(TickPoint tp
in
this
.chart.DefaultView.ChartArea.AxisX.TickPoints)
{
ToolTipService.SetToolTip(tp, tp.Label +
"aaa"
);
}
}
Is there a way to set a tooltip on the tickpoint?
Thanks,
Danny
0
Accepted
Hello Danny,
Attached to this message, is a small application, which handles a functionality close to the one which we discussed. I hope it gets you started properly.
Regards,
Yavor
the Telerik team
Attached to this message, is a small application, which handles a functionality close to the one which we discussed. I hope it gets you started properly.
Regards,
Yavor
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
Danny Scheelings
Top achievements
Rank 1
answered on 02 Sep 2010, 11:31 AM
Yavor,
This is great! Thx !!!!
This is great! Thx !!!!
0
Hello Danny,
I am glad that the solution is working as per your requirements. Since there is no easy way to set the tooltip for the items from the code-behind via the TooltipService.SetTooltip() method, this is the best alternative. Let me know if further questions arise.
Best wishes,
Yavor
the Telerik team
I am glad that the solution is working as per your requirements. Since there is no easy way to set the tooltip for the items from the code-behind via the TooltipService.SetTooltip() method, this is the best alternative. Let me know if further questions arise.
Best wishes,
Yavor
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
Lauren
Top achievements
Rank 1
answered on 10 Sep 2010, 08:51 PM
Hi,
This is exactly what i was looking for. Or almost...
Is there a way to apply this to the X-axis only ?
In the ItemLabelStyle, i set the Width property and use TextTrimming. And in the tooltip, i show the full x-axis category.
But it seems that this width is also applied to the Y-axis.
How can i apply this to the x-axis only ?
Thanks for your help.
-------
This is exactly what i was looking for. Or almost...
Is there a way to apply this to the X-axis only ?
In the ItemLabelStyle, i set the Width property and use TextTrimming. And in the tooltip, i show the full x-axis category.
But it seems that this width is also applied to the Y-axis.
How can i apply this to the x-axis only ?
Thanks for your help.
-------
<
telerikCharting:LabelFormatConverter
x:Name
=
"labelFormatConverter"
></
telerikCharting:LabelFormatConverter
>
<
local:MyConverter
x:Key
=
"myConverter"
></
local:MyConverter
>
<
Style
TargetType
=
"telerikCharting:AxisLabel2D"
>
<
Setter
Property
=
"HorizontalAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"VerticalAlignment"
Value
=
"Top"
/>
<
Setter
Property
=
"ItemLabelStyle"
>
<
Setter.Value
>
<
Style
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"TextAlignment"
Value
=
"Right"
/>
<
Setter
Property
=
"Width"
Value
=
"80"
/>
<
Setter
Property
=
"TextTrimming"
Value
=
"WordEllipsis"
/>
</
Style
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerikCharting:AxisLabel2D"
>
<
telerik:LayoutTransformControl
x:Name
=
"PART_LayoutTransformControl"
HorizontalAlignment
=
"{TemplateBinding HorizontalAlignment}"
VerticalAlignment
=
"{TemplateBinding VerticalAlignment}"
>
<
telerik:LayoutTransformControl.LayoutTransform
>
<
RotateTransform
x:Name
=
"PART_RotateTransform"
/>
</
telerik:LayoutTransformControl.LayoutTransform
>
<
TextBlock
Style
=
"{TemplateBinding ItemLabelStyle}"
Text
=
"{Binding Converter={StaticResource labelFormatConverter}}"
ToolTipService.ToolTip
=
"{Binding Converter={StaticResource myConverter}}"
/>
</
telerik:LayoutTransformControl
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
0
Hello Lauren,
One straightforward solution is to use the converter and determine the value(s):
based on the parameter passed.
Alternatively, you can keep in mind that first the values along the y-axis are populated, and then these along the x axis. Thus, you can use two counters, to determine when to return different values.
I hope this information helps. Let me knoe how it goes.
Sincerely yours,
Yavor
the Telerik team
One straightforward solution is to use the converter and determine the value(s):
public class MyConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return "some Custom Value";
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
based on the parameter passed.
Alternatively, you can keep in mind that first the values along the y-axis are populated, and then these along the x axis. Thus, you can use two counters, to determine when to return different values.
I hope this information helps. Let me knoe how it goes.
Sincerely yours,
Yavor
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
vijay
Top achievements
Rank 1
answered on 16 Aug 2011, 08:09 AM
Hi Team/Danny ,
thanks it is working.
But not working when we applied themeas.
for ex: I have applied the following theme "ToolTip is not coming"
StyleManager.SetTheme(Chart1, new Expression_DarkTheme());
can you please help me...i need the solution very urgent.
Thanks
-VIjay
thanks it is working.
But not working when we applied themeas.
for ex: I have applied the following theme "ToolTip is not coming"
StyleManager.SetTheme(Chart1, new Expression_DarkTheme());
can you please help me...i need the solution very urgent.
Thanks
-VIjay
0
vijay
Top achievements
Rank 1
answered on 23 Sep 2011, 05:24 AM
Hi Team,
still i am waiting for the tool tip on axisX lables...
can you update the solution as soon as possibel..
thanks in advance
-Vijay Kommalapati
still i am waiting for the tool tip on axisX lables...
can you update the solution as soon as possibel..
thanks in advance
-Vijay Kommalapati
0
Hi Vijay,
If the sample is not working as per your requirements, you can open a formal support ticket, and send us the problematic code, for additional review and testing.
Greetings,
Yavor
the Telerik team
If the sample is not working as per your requirements, you can open a formal support ticket, and send us the problematic code, for additional review and testing.
Greetings,
Yavor
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
vijay
Top achievements
Rank 1
answered on 05 Oct 2011, 10:35 AM
please give me option to send complete solution.
0
Hi Vijay,
You cannot send the sample here in the forum - you can attach it in a support ticket.
Regards,
Yavor
the Telerik team
You cannot send the sample here in the forum - you can attach it in a support ticket.
Regards,
Yavor
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>