我正在以编程方式创建一个图表 (DataVisualization.Charting.Chart),它是一个堆积条形图。
我还以编程方式向其中添加图例条目。我想在图表底部显示图例。
但是,这样做时,图例与图表的 X 轴重叠。
这是我正在使用的代码:
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
下面的语句将该图例添加到图表中
_msChart.Legends.Add(GetLegend("SomeValue1", 10.0F))
任何想法,缺少什么?我只想在底部显示图例,但不应与 X 轴重叠。