Hi,
We face an issue that itemsource in chart for X-ASiX label is too long, we want to short the name but provide the whole text tooltip for user.
In this link : http://www.telerik.com/community/forums/silverlight/chart/tooltips-on-xaxis-labels.aspx,
Telerik guy provided a solution which doesn't work since the coverterer only knows the Label and Labelformat, the label has the linking to the itemsource, that means we could not change the label. Therefore, does it exists a way to provide a toolip on xaxis label.
Does exist a chance that we can inhert the tickpoint and a more info to it or exists a way to provide a toolip on xaxis label.
code shot:
We face an issue that itemsource in chart for X-ASiX label is too long, we want to short the name but provide the whole text tooltip for user.
In this link : http://www.telerik.com/community/forums/silverlight/chart/tooltips-on-xaxis-labels.aspx,
Telerik guy provided a solution which doesn't work since the coverterer only knows the Label and Labelformat, the label has the linking to the itemsource, that means we could not change the label. Therefore, does it exists a way to provide a toolip on xaxis label.
Does exist a chance that we can inhert the tickpoint and a more info to it or exists a way to provide a toolip on xaxis label.
code shot:
<
chart:RadChart
x:Name
=
"radChart"
Grid.Row
=
"1"
Style
=
"{StaticResource RadChartStyle}"
>
<
chart:RadChart.SeriesMappings
>
<
charting:SeriesMapping
LegendLabel
=
"On Shore"
CollectionIndex
=
"0"
>
<
charting:SeriesMapping.SeriesDefinition
>
<
charting:StackedBar100SeriesDefinition
ShowItemToolTips
=
"True"
StackGroupName
=
"Sourcing"
SeriesName
=
"On Shore"
ItemToolTipFormat
=
"#STPERCENT{#0.#%}"
/>
</
charting:SeriesMapping.SeriesDefinition
>
<
charting:ItemMapping
DataPointMember
=
"YValue"
FieldName
=
"Count"
/>
<
charting:ItemMapping
DataPointMember
=
"XCategory"
FieldName
=
"Type"
/>
</
charting:SeriesMapping
>
<
charting:SeriesMapping
LegendLabel
=
"Off Shore"
CollectionIndex
=
"1"
>
<
charting:SeriesMapping.SeriesDefinition
>
<
charting:StackedBar100SeriesDefinition
ShowItemToolTips
=
"True"
StackGroupName
=
"Sourcing"
SeriesName
=
"Off Shore"
ItemToolTipFormat
=
"#STPERCENT{#0.#%}"
/>
</
charting:SeriesMapping.SeriesDefinition
>
<
charting:ItemMapping
DataPointMember
=
"YValue"
FieldName
=
"Count"
/>
<
charting:ItemMapping
DataPointMember
=
"XCategory"
FieldName
=
"Type"
/>
</
charting:SeriesMapping
>
<
charting:SeriesMapping
LegendLabel
=
"Others"
CollectionIndex
=
"2"
>
<
charting:SeriesMapping.SeriesDefinition
>
<
charting:StackedBar100SeriesDefinition
StackGroupName
=
"Sourcing"
ShowItemToolTips
=
"True"
SeriesName
=
"Third Party Resources"
ItemToolTipFormat
=
"#STPERCENT{#0.#%}"
/>
</
charting:SeriesMapping.SeriesDefinition
>
<
charting:ItemMapping
DataPointMember
=
"YValue"
FieldName
=
"Count"
/>
<
charting:ItemMapping
DataPointMember
=
"XCategory"
FieldName
=
"Type"
/>
</
charting:SeriesMapping
>
</
chart:RadChart.SeriesMappings
>
</
chart:RadChart
>
<
telerikCharting:LabelFormatConverter
x:Name
=
"labelFormatConverter"
></
telerikCharting:LabelFormatConverter
>
<
local:MyConverter
x:Key
=
"myConverter"
></
local:MyConverter
>
<
Style
TargetType
=
"telerik:AxisLabel2D"
>
<
Setter
Property
=
"HorizontalAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"VerticalAlignment"
Value
=
"Top"
/>
<
Setter
Property
=
"ItemLabelStyle"
>
<
Setter.Value
>
<
Style
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"TextAlignment"
Value
=
"Center"
/>
</
Style
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik: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
>
public
class
StackedBarToolTipConverter : IValueConverter
{
/// <summary>
/// Convert
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public
object
Convert(
object
value, Type targetType,
object
parameter, CultureInfo culture)
{
TickPoint p = value
as
TickPoint;
return
p.LabelFormat;
}
/// <summary>
/// Convert Back
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public
object
ConvertBack(
object
value, Type targetType,
object
parameter, CultureInfo culture)
{
throw
new
NotImplementedException();
}
}