将图表放在页面中心 [英] Position a Chart In the Center of the Page
本文介绍了将图表放在页面中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁知道如何将图表定位在页面的中心?该图表现在总是出现在页面左侧。
这是我的代码:
Hi,
does anyone know how can I position the chart at the center of the page? The chart always appear on the left of the page right now.
This is my codes:
Chart Chart1 = new Chart();
Chart1.DataSource = dt;
Chart1.Width = 715;
Chart1.Height = 450;
Chart1.Series.Add(new Series());
Chart1.Series[0].ChartType = SeriesChartType.BoxPlot;
List<object> List1 = dt_LVL1RISKCHART.AsEnumerable().ToList<object>();
foreach (DataRow row in dt.Rows)
Chart1.Series[0].Points.AddXY(row["STATUS"], new object[] { row["MIN"], row["MAX"], row["25TH_PERCENTILE"], row["75TH_PERCENTILE"], row["AVG"], row["50TH_PERCENTILE"] });
//create chartareas
ChartArea ca = new ChartArea();
ca .AxisX = new Axis();
ca .AxisY = new Axis();
Chart1.ChartAreas.Add(ca);
//databind
Chart1.DataBind();
Chart1.Visible = true;
感谢所有人都可以帮助我,非常感谢!!
问候,
Felicia
Appreciate if anyone can help me on this, thanks a lot!!
Regards,
Felicia
推荐答案
试试这样:
Try it like this :
this.Chart1.Location = new Point((this.Width - this.Chart1.Width) / 2, (this.Height - this.Chart1.Height) / 2) ;
这篇关于将图表放在页面中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文