BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi Karl,
Thanks for using Syncfusion products.
We have analyzed your reported query; you can customize chart legend by using ChartLegend list collection. Series collections bind to legend items by using LegendName property.
Following code snippet illustrates how to add custom legends.
Code Snippet [WF]:Form1.cs
· Series Name added to series text.
series1.Name = "Car";
series1.Text = series1.Name;
series2.Name = "Truck";
series2.Text = series2.Name;
series3.Name = "2wd";
series3.Text = series3.Name;
series4.Name = "4wd";
series4.Text = series4.Name;
· Legend collection instance created as below
ChartLegend legend1 = new ChartLegend(chart);
ChartLegend legend2 = new ChartLegend(chart);
legend1.Name = "legend1";
legend2.Name = "legend2";
legend1.Text = "Color Legend";
legend2.Text = "Symbol Legend";
· Binding each series collection to legend collection by using LegendName property
series1.LegendName = "legend1";
series2.LegendName = "legend1";
series3.LegendName = "legend2";
series4.LegendName = "legend2";
ScreenShot:
We have prepared below sample, you can download it from below link
Sample Link:
WindowsFormsApplication11.zip
Please let us know if you have any concern.
Thanks,
Vinothkumar Arumugam.
chart.Legend.MouseHover+=Legend_MouseHover;
void Legend_MouseHover(object sender, EventArgs e)
{
Point p1 =this.chart.Legend.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y));
ChartLegendItem item = chart.Legend.GetItemBy(p1);
if (item != null)
this.toolTip.Show(item.Text, chart.Legend, p1.X + 10, p1.Y + 10, 1000);
}
The Legend.GetItemBy method will let you get the reference to a legend item at a specific point .
Screenshot :
Please find the below sample link to download the sample
Sample Location:
WindowsFormsApplication11
Kindly refer our below online documentation link for more details
http://help.syncfusion.com/ug/windows%20forms/Documents/chartlegendandlegenditems.htm
Please let us know if you have any concern.
Thanks,
Vinothkumar Arumugam.
chart.Legend.MouseHover+=Legend_MouseHover;
void Legend_MouseHover(object sender, EventArgs e)
{
Point p1 =chart.Legend.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y));
foreach (var items in chart.Legend.Items)
{
if(p1.X > items.Bounds.X && p1.X<(items.Bounds.X+items.Bounds.Width+items.Bounds.Right))
this.toolTip.Show(items.Text, chart.Legend, p1.X + 10, p1.Y + 10, 1000);
}
}
Screenshot of the attached sample result:
Please find the below sample location to download the sample
Sample Location:
WindowsFormsApplication11
Please let us know if you have any concern.
Thanks,
Vinothkumar Arumugam.
Hi Karl,
Thanks for the update.
Please let us know if you have any further query on this.
Thanks,
Vinothkumar Arumugam.