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

[Solved] Telerik MVC chart: Display legend name in the tool tip of a pie chart

1 Answer 18 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
chandra
Top achievements
Rank 1
chandra asked on 08 Feb 2013, 05:01 PM
I am Trying to display a legend in the tool tip of a pie chart on mouse hover.
Below is my rode in razor file code 

@(Html.Telerik().Chart(Model.ProductSubComposites)
.Name("pieChart")
.(Html.GetCurrentTheme())
.Title(title=>title.Text("Agent Sales Percentage")
		.Font("normal normal bold 10px verdana"))
		.Legend(legend => legend.Visible(true)
		.Position(ChartLegendPosition.Bottom)
		.Font("normal normal normal 9px verdana")
		.Color("#8B4513"))
.SeriesColors(Extensions.GetPieColors())
.Series(series =>{series.Pie("AmountPercentage""ProductName")
			.Labels(label => label.Visible(true)
				.Template("<#= value #>%")
				.Align((ChartPieLabelsAlign.Column))
				.Color("#CC0000")
				.Position((ChartPieLabelsPosition.OutsideEnd)))
			.StartAngle(90)
			.Padding(30);
			})
.ClientEvents(events => events.OnSeriesClick("onSeriesClick"))
.Tooltip(tooltip => tooltip.Visible(true).Template("<#= value #>%"))
.HtmlAttributes(new { style = "width: 250px; height: 400px;" })


Please let me know if there is tooltip template that fetches legend name

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 13 Feb 2013, 04:22 PM
Hi Chandra,

Generally speaking you can access the original data via the dataItem. Hence using a template for the tooltip you can show the series' name (which actually shows the Legend) in the tooltip. For example: 
.Tooltip(tooltip => tooltip.Visible(true).Template("<#= dataItem.Source #>%"))
I hope this information helps.
 
Kind regards,
Iliana Nikolova
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
General Discussions
Asked by
chandra
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or