charts: Legend overlapping with X-axis


I am creating a Chart (DataVisualization.Charting.Chart) programmatically, which is a Stacked Bar chart.

I am also adding Legend entries programmatically to it. I want to show the Legend at the bottom of the chart.

But, while doing so, the Legend overlapps with the X-axis of the chart.

Here is the code I am using:

[code]Private Function GetLegend(ByVal legendName As String, ByVal s As Single) As System.Windows.Forms.DataVisualization.Charting.Legend

Dim objLegend As System.Windows.Forms.DataVisualization.Charting.Legend = New System.Windows.Forms.DataVisualization.Charting.Legend()

objLegend.Name = legendName
objLegend.Font = New System.Drawing.Font("Verdana", s)
objLegend.IsDockedInsideChartArea = False
objLegend.Docking = Docking.Bottom
Return objLegend
End Function


Below statement adds that Legend to the chart :

_msChart.Legends.Add(GetLegend("SomeValue1", 10.0F))

Any idea, what is missing? I want to show the legend at the bottom only, but it should not overlapp with the X-axis.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!