I create a chart (DataVisualization.Charting.Chart) programmatically, which is a gated histogram.
I also add Legend program records to it. I want to show the Legend at the bottom of the chart.
But at the same time, Legend overlaps with the X axis of the chart.
Here is the code I'm using:
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 the operator adds Legend to the diagram
_msChart.Legends.Add(GetLegend("SomeValue1", 10.0F))
Any idea what is missing? I want to show the legend only below, but it should not overlap with the X axis.
source
share