I'm using custom palette for Line series but its not working.
I'm posting my code here. Plz have a look and answer.
Check out the Bold & Italic Code which i designed for Custom Palette for Line Series.
I'm posting my code here. Plz have a look and answer.
private
void
MultipleYAxis()
{
//Custom Point Mark Style
radChart1.DefaultSeriesDefinition.PointMarkItemStyle =
this
.radChart1.Resources[
"CustomStyle"
]
as
Style;
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;
//Hide Y Axis
radChart1.DefaultView.ChartArea.AxisY.Visibility = Visibility.Collapsed;
//Styles for axises
radChart1.DefaultView.ChartArea.AdditionalYAxes[0].AxisStyles.AxisLineStyle =
this
.Resources[
"CustomAxisYStyle3"
]
as
Style;
//radChart1.DefaultView.ChartArea.AdditionalYAxes[0].AxisStyles.TickLineStyle = this.Resources["CustomAxisYStyle3"] as Style;
//radChart1.DefaultView.ChartArea.AdditionalYAxes[0].AxisStyles.MinorTickLineStyle = this.Resources["CustomAxisYStyle3"] as Style;
radChart1.DefaultView.ChartArea.AdditionalYAxes[1].AxisStyles.AxisLineStyle =
this
.Resources[
"CustomAxisYStyle2"
]
as
Style;
radChart1.DefaultView.ChartArea.AdditionalYAxes[1].AxisStyles.TickLineStyle =
this
.Resources[
"CustomAxisYStyle2"
]
as
Style;
radChart1.DefaultView.ChartArea.AdditionalYAxes[1].AxisStyles.MinorTickLineStyle =
this
.Resources[
"CustomAxisYStyle2"
]
as
Style;
radChart1.DefaultView.ChartArea.AdditionalYAxes[2].AxisStyles.AxisLineStyle =
this
.Resources[
"CustomAxisYStyle1"
]
as
Style;
radChart1.DefaultView.ChartArea.AdditionalYAxes[2].AxisStyles.TickLineStyle =
this
.Resources[
"CustomAxisYStyle1"
]
as
Style;
radChart1.DefaultView.ChartArea.AdditionalYAxes[2].AxisStyles.MinorTickLineStyle =
this
.Resources[
"CustomAxisYStyle1"
]
as
Style;
//Series mapping for the collection with index 0
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;
//Chart Custom Tool Tips
radChart1.DefaultView.ChartArea.ItemToolTipOpening +=
this
.ChartItemToolTipOpening;
//Chart Axis Style
//this.radChart1.DefaultView.ChartArea.AxisX.AxisStyles.TickLineStyle = this.Resources["CustomAxisYStyle1"] as Style;
//this.radChart1.DefaultView.ChartArea.AxisY.AxisStyles.AxisLineStyle = this.Resources["CustomAxisYStyle2"] as Style;
//Custom color Palette for Line Series
Color[] colors =
new
Color[] { Colors.Purple, Colors.Yellow, Colors.Blue, Colors.Green };
for
(
int
i = 0; i < radChart1.SeriesMappings.Count; i++)
{
radChart1.SeriesMappings[i].SeriesDefinition.Appearance.Fill = colors[i];
}
radChart1.ItemsSource =
new
TrafficInfoCollection();
}
Check out the Bold & Italic Code which i designed for Custom Palette for Line Series.