lawphotog lawphotog - 1 year ago 67
ASP.NET (C#) Question

How to make series labels to show without overlapping each other? ASP.NET 4.0

I am developing a chart (using ASP.NET CHART CONTROL) with about 2 or 3 series on it. Please look how it looks like now. As you can see, the labels are overlapping each other and it does not look very good. Is there any way I can solve this problem and improve the overall look of the chart?


enter image description here

My code:

series.ChartType = SeriesChartType.Line
series.YValueType = ChartValueType.Double
series.XValueType = ChartValueType.String
series.BorderWidth = 1
series.ShadowOffset = 1
series.IsValueShownAsLabel = True
series.ToolTip = dtrow.ToString
series.LabelForeColor = Color.Gray

series.LabelToolTip = dtrow.ToString


Answer Source

Enable Smart Labels.

Chart1.Series["Series1"].SmartLabels.Enabled = true;

Take a look here SmartLabels