Click here to Skip to main content
15,888,257 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi Members,
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.

I have researched online for awhile but could not figure out how to do this.

This is my codes:
HTML
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
Posted
Updated 4-Oct-15 7:08am
v3

If you know CSS, do like this.
I think you use Chart1 as ID

So your css like,

#Chart1{font-weight:bold;}
 
Share this answer
 
You have the Property "Titles".
Here you can add a/the Chart-Title and inside this you could define the Chart-Title itself and the used Font (and Font-Style).

C#
Chart1.Titles.Add(title);
 
Chart1.Titles(0).Font = ...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900