custom ToolTip Required in Multiple Y-Axis Line Series. I'm posting my Code here.
Plz have a generous look. Also check out the attachment for my tooltip requirement.
Please try to answer in c# only or code behind.
Plz have a generous look. Also check out the attachment for my tooltip requirement.
Please try to answer in c# only or code behind.
private
void
MultipleYAxis()
{
radChart1.DefaultView.ChartArea.AdditionalYAxes.Add(
new
AxisY());
radChart1.DefaultView.ChartArea.AdditionalYAxes.Add(
new
AxisY());
radChart1.DefaultView.ChartArea.AdditionalYAxes.Add(
new
AxisY());
radChart1.DefaultView.ChartArea.AdditionalYAxes[0].AxisName =
"Visits"
;
radChart1.DefaultView.ChartArea.AdditionalYAxes[1].AxisName =
"IMPVisits"
;
radChart1.DefaultView.ChartArea.AdditionalYAxes[2].AxisName =
"MissedVisits"
;
//radChart1.DefaultSeriesDefinition.InteractivitySettings.HoverScope = InteractivityScope.Series;
//radChart1.DefaultSeriesDefinition.InteractivitySettings.SelectionScope = InteractivityScope.Series;
SeriesMapping seriesMapping =
new
SeriesMapping();
seriesMapping.SeriesDefinition =
new
LineSeriesDefinition() { PointMarkItemStyle =
this
.Resources[
"CustomStyle"
]
as
Style};
seriesMapping.SeriesDefinition.InteractivitySettings.HoverScope = InteractivityScope.Series;
seriesMapping.SeriesDefinition.AxisName =
"Visits"
;
seriesMapping.LegendLabel =
"Visits"
;
seriesMapping.SeriesDefinition.ShowItemLabels =
false
;
seriesMapping.ItemMappings.Add(
new
ItemMapping(
"Visits"
, DataPointMember.YValue ) );
seriesMapping.ItemMappings.Add(
new
ItemMapping(
"Date"
, DataPointMember.XValue));
radChart1.SeriesMappings.Add( seriesMapping );
seriesMapping =
new
SeriesMapping();
seriesMapping.LegendLabel =
"IMPVisits"
;
seriesMapping.SeriesDefinition =
new
LineSeriesDefinition();
seriesMapping.SeriesDefinition.InteractivitySettings.HoverScope = InteractivityScope.Series;
seriesMapping.SeriesDefinition.AxisName =
"IMPVisits"
;
seriesMapping.SeriesDefinition.ShowItemLabels =
false
;
seriesMapping.ItemMappings.Add(
new
ItemMapping(
"IMPVisits"
, DataPointMember.YValue ) );
seriesMapping.ItemMappings.Add(
new
ItemMapping(
"Date"
, DataPointMember.XValue));
radChart1.SeriesMappings.Add( seriesMapping );
seriesMapping =
new
SeriesMapping();
seriesMapping.LegendLabel =
"Missed Visits"
;
seriesMapping.SeriesDefinition =
new
LineSeriesDefinition();
seriesMapping.SeriesDefinition.InteractivitySettings.HoverScope = InteractivityScope.Series;
seriesMapping.SeriesDefinition.AxisName =
"MissedVisits"
;
seriesMapping.SeriesDefinition.ShowItemLabels =
false
;
seriesMapping.ItemMappings.Add(
new
ItemMapping(
"MissedVisits"
, DataPointMember.YValue));
seriesMapping.ItemMappings.Add(
new
ItemMapping(
"Date"
, DataPointMember.XValue));
radChart1.SeriesMappings.Add(seriesMapping);
//Chart Legend
radChart1.DefaultView.ChartLegend.UseAutoGeneratedItems =
true
;
radChart1.DefaultView.ChartLegend.Header =
"Monthly Visits"
;
radChart1.DefaultView.ChartLegendPosition = Telerik.Windows.Controls.Dock.Top;
//Chart X-Axis Labels
radChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat =
"dd-MMM-yyyy"
;
radChart1.DefaultView.ChartArea.AxisX.LabelRotationAngle = 50;
radChart1.ItemsSource =
new
TrafficInfoCollection();
}
//Items Source for Chart
public
class
TrafficInfoCollection : IEnumerable<TrafficInfo>
{
public
IEnumerator<TrafficInfo> GetEnumerator()
{
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"12/27/2008"
, CultureInfo.InvariantCulture), Visits = 1991, IMPVisits = 1900,MissedVisits=1581 };
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"12/28/2008"
, CultureInfo.InvariantCulture), Visits = 2141, IMPVisits = 1800,MissedVisits=1652 };
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"12/29/2008"
, CultureInfo.InvariantCulture), Visits = 3820, IMPVisits = 1700 ,MissedVisits=6876};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"12/30/2008"
, CultureInfo.InvariantCulture), Visits = 3945, IMPVisits = 3900 ,MissedVisits=1235};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"12/31/2008"
, CultureInfo.InvariantCulture), Visits = 3256, IMPVisits = 2900 ,MissedVisits=1648};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/1/2009"
, CultureInfo.InvariantCulture), Visits = 1633, IMPVisits = 3200 ,MissedVisits=3265};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/2/2009"
, CultureInfo.InvariantCulture), Visits = 3311, IMPVisits = 4900 ,MissedVisits=5896};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/3/2009"
, CultureInfo.InvariantCulture), Visits = 2171, IMPVisits = 4320 ,MissedVisits=4578};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/4/2009"
, CultureInfo.InvariantCulture), Visits = 2053, IMPVisits = 2100 ,MissedVisits=7562};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/5/2009"
, CultureInfo.InvariantCulture), Visits = 4582, IMPVisits = 2450 ,MissedVisits=6564};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/6/2009"
, CultureInfo.InvariantCulture), Visits = 5117, IMPVisits = 4200 ,MissedVisits=1354};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/7/2009"
, CultureInfo.InvariantCulture), Visits = 5383, IMPVisits = 1560,MissedVisits= 1354};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/8/2009"
, CultureInfo.InvariantCulture), Visits = 5882, IMPVisits = 4500 ,MissedVisits=5463};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/9/2009"
, CultureInfo.InvariantCulture), Visits = 5399, IMPVisits = 2900 ,MissedVisits=5463};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/10/2009"
, CultureInfo.InvariantCulture), Visits = 2838, IMPVisits = 4190 ,MissedVisits=7945};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/11/2009"
, CultureInfo.InvariantCulture), Visits = 3416, IMPVisits = 3500 ,MissedVisits=1235};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/12/2009"
, CultureInfo.InvariantCulture), Visits = 5833, IMPVisits = 2500 ,MissedVisits=3164};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/13/2009"
, CultureInfo.InvariantCulture), Visits = 6167, IMPVisits = 1230 ,MissedVisits=1356};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/14/2009"
, CultureInfo.InvariantCulture), Visits = 5813, IMPVisits = 2150 ,MissedVisits=9652};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/15/2009"
, CultureInfo.InvariantCulture), Visits = 5584, IMPVisits = 2640 ,MissedVisits=4566};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/16/2009"
, CultureInfo.InvariantCulture), Visits = 5061, IMPVisits = 4123 ,MissedVisits=3215};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/17/2009"
, CultureInfo.InvariantCulture), Visits = 2268, IMPVisits = 2134 ,MissedVisits=5544};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/18/2009"
, CultureInfo.InvariantCulture), Visits = 2231, IMPVisits = 4215 ,MissedVisits=1456};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/19/2009"
, CultureInfo.InvariantCulture), Visits = 5385, IMPVisits = 1956 ,MissedVisits=1369};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/20/2009"
, CultureInfo.InvariantCulture), Visits = 5632, IMPVisits = 2300 ,MissedVisits=1548};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/21/2009"
, CultureInfo.InvariantCulture), Visits = 5749, IMPVisits = 1900,MissedVisits= 4462};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/22/2009"
, CultureInfo.InvariantCulture), Visits = 5800, IMPVisits = 2640,MissedVisits= 4152};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/23/2009"
, CultureInfo.InvariantCulture), Visits = 5057, IMPVisits = 3500 ,MissedVisits=1236};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/24/2009"
, CultureInfo.InvariantCulture), Visits = 2418, IMPVisits = 3800,MissedVisits= 1639};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/25/2009"
, CultureInfo.InvariantCulture), Visits = 2221, IMPVisits = 4000 ,MissedVisits=1475};
yield
return
new
TrafficInfo { Date = DateTime.Parse(
"1/26/2009"
, CultureInfo.InvariantCulture), Visits = 4584, IMPVisits = 4250,MissedVisits=1369 };
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return
((IEnumerable<TrafficInfo>)
this
).GetEnumerator();
}
}
public
class
TrafficInfo
{
public
DateTime Date {
get
;
set
; }
public
int
Visits {
get
;
set
; }
public
int
IMPVisits {
get
;
set
; }
public
int
MissedVisits {
get
;
set
; }
}