Hello, Mohsen,
Dimitar is out of office today, so I will be handling this thread for you. Straight to your questions:
1. In order to switch the title and marker elements in the legend you can handle the ChartElement.LegendElement.
VisualItemCreating event and use the following custom legend item element:
public
RadForm1()
{
InitializeComponent();
this
.radChartView1.ChartElement.LegendElement.VisualItemCreating += LegendElement_VisualItemCreating;
LineSeries lineSeries =
new
LineSeries();
lineSeries.LegendTitle =
"AC"
;
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(20,
"Jan"
));
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(22,
"Apr"
));
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(12,
"Jul"
));
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(19,
"Oct"
));
this
.radChartView1.Series.Add(lineSeries);
LineSeries lineSeries2 =
new
LineSeries();
lineSeries2.LegendTitle =
"BC"
;
lineSeries2.DataPoints.Add(
new
CategoricalDataPoint(18,
"Jan"
));
lineSeries2.DataPoints.Add(
new
CategoricalDataPoint(15,
"Apr"
));
lineSeries2.DataPoints.Add(
new
CategoricalDataPoint(17,
"Jul"
));
lineSeries2.DataPoints.Add(
new
CategoricalDataPoint(22,
"Oct"
));
this
.radChartView1.Series.Add(lineSeries2);
this
.radChartView1.ShowGrid =
true
;
this
.radChartView1.ShowLegend =
true
;
}
private
void
LegendElement_VisualItemCreating(
object
sender, LegendItemElementCreatingEventArgs e)
{
e.ItemElement =
new
CustomLegendItemElement(e.LegendItem);
}
public
class
CustomLegendItemElement : LegendItemElement
{
public
CustomLegendItemElement(LegendItem item) :
base
(item)
{
}
protected
override
void
CreateChildElements()
{
base
.CreateChildElements();
this
.Children.Clear();
this
.Children.Add(
this
.TitleElement);
this
.Children.Add(
this
.MarkerElement);
}
}
2. It is appropriate to use grid line annotations which are lines or circles that cross the chart grid at location on the axis, specified by their Value property. Additional information is available in the following help article:
https://docs.telerik.com/devtools/winforms/controls/chartview/features/annotations/grid-line
3. If I understand your requirement correctly, you need to indicate that two
LineSeries may be completely overlapped. I can suggest you to make the
LineSeries with thicker line by setting the
BorderWidth property:
LineSeries lineSeries =
new
LineSeries();
lineSeries.LegendTitle =
"AC"
;
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(20,
"Jan"
));
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(22,
"Apr"
));
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(12,
"Jul"
));
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(19,
"Oct"
));
this
.radChartView1.Series.Add(lineSeries);
LineSeries lineSeries2 =
new
LineSeries();
lineSeries2.LegendTitle =
"BC"
;
lineSeries2.DataPoints.Add(
new
CategoricalDataPoint(18,
"Jan"
));
lineSeries2.DataPoints.Add(
new
CategoricalDataPoint(15,
"Apr"
));
lineSeries2.DataPoints.Add(
new
CategoricalDataPoint(17,
"Jul"
));
lineSeries2.DataPoints.Add(
new
CategoricalDataPoint(22,
"Oct"
));
this
.radChartView1.Series.Add(lineSeries2);
LineSeries lineSeries3 =
new
LineSeries();
lineSeries3.LegendTitle =
"CD"
;
lineSeries3.DataPoints.Add(
new
CategoricalDataPoint(18,
"Jan"
));
lineSeries3.DataPoints.Add(
new
CategoricalDataPoint(15,
"Apr"
));
lineSeries3.DataPoints.Add(
new
CategoricalDataPoint(17,
"Jul"
));
lineSeries3.DataPoints.Add(
new
CategoricalDataPoint(22,
"Oct"
));
this
.radChartView1.Series.Add(lineSeries3);
this
.radChartView1.ShowGrid =
true
;
this
.radChartView1.ShowLegend =
true
;
lineSeries.Shape =
new
StarShape();
lineSeries.PointSize =
new
SizeF(20, 20);
lineSeries2.Shape =
new
CircleShape();
lineSeries2.PointSize =
new
SizeF(20, 20);
lineSeries.BorderWidth = 2;
lineSeries2.BorderWidth = 2;
lineSeries3.BorderWidth = 4;
}
4. You can specify what shape to be used in the
LineSeries by setting the
LineSeries. Shape property and adjusting the
PointSize:
Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. This reply was handled by the Telerik support as an exception for you. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread. Thank you for your understanding.
I hope this information helps.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get
quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.
Learn More.