dotnetcharting X轴间隔 设置

liyachi 2010-11-03 06:07:51
dotnetcharting 生成的柱状图后,X轴上的文字和生成的柱子位置无法对齐,

不知道设置那个属性可以使两者对齐呢

谢谢各位

这是柱状图的源码
// Set the title.
ChartReport.Title = "委托单类型统计";

ChartReport.Palette = new Color[] { Color.FromArgb(49, 255, 49), Color.FromArgb(255, 255, 0), Color.FromArgb(255, 99, 49), Color.FromArgb(0, 156, 255) };

// Change the shading mode
ChartReport.ShadingEffectMode = ShadingEffectMode.One;

// Set the x axis label
//ChartReport.XAxis.Label.Text = "";

ChartReport.DefaultElement.ShowValue = true;

// Set the y axis label
//ChartReport.YAxis.Label.Text = "数量";

// Set the directory where the images will be stored.
//Chart.TempDirectory = "temp";


// Set he chart size.
ChartReport.Width = 850;
ChartReport.Height = 450;

//ChartReport.XAxis.StaticColumnWidth = 140; //每个单元格的宽度
//ChartReport.XAxis.TimeScaleLabels.RangeIntervals.Add(TimeInterval.Years);

// Add the random data.
ChartReport.SeriesCollection.Add(getRandomData());
...全文
140 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzm___716 2012-09-14
  • 打赏
  • 举报
回复
问题出在你的getRandomData中。

每次只能新建一个Series。
代码:
Series s = new Series();
foreach (DataRow r in table.Rows)
{

Element e = new Element(r[x].ToString());
e.YValue = Convert.ToDouble(r[y]);
s.Elements.Add(e);
SC.Add(s);
}
yueye1984 2011-03-21
  • 打赏
  • 举报
回复
我晕,我还以为解决了
pudong000 2010-11-15
  • 打赏
  • 举报
回复
我也碰到这种情况,至今没有解决。另外,如果Chart的数据不是绑定在一个数据表,而是自己赋值,如:
s.Elements.Add(tempElement)
SC.Add(s)
那么,生成图表的柱子的宽度也无法设置
liyachi 2010-11-04
  • 打赏
  • 举报
回复
没有人遇到过这个问题吗?

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧