I can create Box Plot Chart dynamically. The issue I faced now is I have no idea how to bold and change the font size of the chart title.
我可以动态创建Box Plot Chart。我现在遇到的问题是我不知道如何加粗和更改图表标题的字体大小。
I have researched online for awhile but could not figure out how to do this.
我已经在网上研究了一段时间,但无法弄清楚如何做到这一点。
This is my codes:
这是我的代码:
Chart Chart1 = new Chart();
Chart1.DataSource = tg;
Chart1.Width = 600;
Chart1.Height = 350;
Chart1.Series.Add(new Series());
Chart1.Series[0].ChartType = SeriesChartType.BoxPlot;
List<object> lst = tg.AsEnumerable().ToList<object>();
foreach (DataRow row in tg.Rows)
Chart1.Series[0].Points.AddXY(row["VALUE"], new object[] { row["Min"], row["Max"], row["Avg"], row["Percentile25"], row["Percentile50"], row["Percentile75"] });
Chart1.Series[0]["PixelPointWidth"] = "38";
string title = (tg.Rows[0]["TITLE"].ToString());
Chart1.Titles.Add(title);
//create chartareas
ChartArea ca = new ChartArea();
ca.AxisX = new Axis();
ca.AxisX.MajorGrid.Enabled = false;
ca.AxisY = new Axis();
ca.AxisY.MajorGrid.Enabled = false;
Chart1.ChartAreas.Add(ca);
//databind
Chart1.DataBind();
Chart1.Visible = true;
panel.Controls.Add(Chart1);
Question: How to Bold Chart Title?
问题:如何加粗图表标题?
How to Change Font Size of Chart Title?
如何更改图表标题的字体大小?
Appreciate if someone could help me on this. Thanks!
感谢有人可以帮助我。谢谢!
Regards,
问候,
Felicia
费利西亚
1 个解决方案
#1
1
Try this:
尝试这个:
Title title = new Title();
title.Font = new Font("Arial", 14, FontStyle.Bold);
title.Text = "My Chart Title";
Chart1.Titles.Add(title);
#1
1
Try this:
尝试这个:
Title title = new Title();
title.Font = new Font("Arial", 14, FontStyle.Bold);
title.Text = "My Chart Title";
Chart1.Titles.Add(title);