为什么MSChart不填写整个图表区域?

我正在创建一些图表,我无法弄清楚为什么图表的左侧和右侧有太多的空白区域。 我有一个Winforms Chart,ChartArea和Series,在图表的左侧和右侧总是有一个很好的英寸,看起来像是浪费了空间。 我需要更改什么设置才能减小这个空白区域的大小? 我已经在这个post中包含了空白空间的图表截图以及我用来创建它的代码。 提前致谢。

在此处输入图像描述

if (listBoxCharts.SelectedItems.Count == 1) { switch (listBoxCharts.SelectedItem.ToString().Trim()) { case "Incomplete Work Orders By Status": ChartArea chartArea = new ChartArea(); Series series = new Series(); Title title = new Title(); chartArea.Area3DStyle.Enable3D = true; chartArea.Area3DStyle.LightStyle = LightStyle.Realistic; chartArea.Area3DStyle.Rotation = 10; chartArea.Area3DStyle.WallWidth = 3; chartArea.BorderColor = Color.Transparent; chartArea.Name = "IncompleteWorkOrdersByStatus_ChartArea"; // Fix this hack ChartContainer.ChartAreas.Clear(); this.ChartContainer.ChartAreas.Add(chartArea); this.ChartContainer.Dock = DockStyle.Fill; this.ChartContainer.Location = new Point(2, 21); this.ChartContainer.Name = "Charts"; this.ChartContainer.PaletteCustomColors = new Color[] { Color.LemonChiffon }; series.ChartArea = "IncompleteWorkOrdersByStatus_ChartArea"; series.ChartType = SeriesChartType.StackedColumn; series.CustomProperties = "DrawingStyle=Cylinder"; series.EmptyPointStyle.BorderDashStyle = ChartDashStyle.NotSet; series.IsXValueIndexed = true; series.Name = "IncompleteWorkOrdersByStatus_Series"; List incompleteWorkOrders = woDao.getIncompleteWorkOrders(); var uniqueStatuses = ( from statuses in incompleteWorkOrders select statuses.fkOrderStatus).Distinct().ToList(); int xVal = 1; foreach (var status in uniqueStatuses) { var count = ( from wo in incompleteWorkOrders where wo.fkOrderStatus == status select wo).Count(); DataPoint dPoint = new DataPoint(xVal, count); if (status == null) { dPoint.AxisLabel = "No Status"; } else { dPoint.AxisLabel = status.codedesc; } dPoint.ToolTip = count + " " + dPoint.AxisLabel; series.Points.Add(dPoint); xVal++; } this.ChartContainer.Series.Clear(); this.ChartContainer.Series.Add(series); title.DockedToChartArea = "IncompleteWorkOrdersByStatus_ChartArea"; title.IsDockedInsideChartArea = false; title.Name = "IncompleteWorkOrdersByStatus_Title"; title.Text = "Incomplete Work Orders By Status"; this.ChartContainer.Titles.Clear(); this.ChartContainer.Titles.Add(title); break; default: break; } } 

尝试使用InnerPlotPosition设置:

 chart1.ChartAreas[0].InnerPlotPosition.X = 0; 
  • 如何向服务器发送“hello”并回复“hi”?
  • 如何在AutoMapper中处理自定义属性
  • 你能SWIG一个boost :: optional 吗?
  • 将列表转换为数据透视列表
  • 将枚举转换为列表
  • 使用c#写入现有Excel文件
  • NHibernate COALESCE问题
  • 在asp.net web api中使用FromBody时,字符串值为空
  • 如何从C#中的文件加载RSA公钥
  • 如何在C#中使用DynamicObject实现事件访问器
  • C#反思:如何获取Nullable 的类型?