[英]How to Bold and Change Font Size of Chart Title
我可以動態創建箱線圖。 我現在面臨的問題是我不知道如何加粗和更改圖表標題的字體大小。
我已經在網上研究了一段時間,但無法弄清楚如何做到這一點。
這是我的代碼:
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);
問題:如何加粗圖表標題?
如何更改圖表標題的字體大小?
感謝有人可以幫助我。 謝謝!
問候,
費利西亞
嘗試這個:
Title title = new Title();
title.Font = new Font("Arial", 14, FontStyle.Bold);
title.Text = "My Chart Title";
Chart1.Titles.Add(title);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.