Reputation: 11
Is it possible to add a custom textbox to a mschart? Example I have a graph, the axislabels, the legend to the right. I want to add a custom text(box) to the chartarea with a textbox with an explaning text about the graph. The reason is because its so easy to save an image of the chart so I want the explanation to be integrated in the picture.
Regards //JH
Upvotes: 0
Views: 1829
Reputation: 279
Chart = CreateChartTemplate();
Title area1Title = new Title(chartTitle, Docking.Top, new Font("Verdana", 12), Color.Black);
area1Title.IsDockedInsideChartArea = false;
area1Title.Docking = Docking.Top;
Chart.Titles.Add(area1Title);
You can use this to set a title on top of the graph outside of the plotted area, you can also change options if you would like it inside chart area.
area1Title.DockedToChartArea
this will allow you to specify an area of the chart to fix it to. i.e top left right etc.
Upvotes: 1
Reputation: 57210
As suggested by @rockyashkumar, you could use chart title to explain the figure.
You can do that using chart.Titles
property, either through visual studio designer or programmatically e.g.:
var title = this.chart1.Titles.Add("The title text");
// set other properties of the title (if necessary)
title.Alignment = ContentAlignment.MiddleCenter;
...
Upvotes: 1