ASP.NET Chart: How to change font in Chart's Title?
The title of my pie chart is rather small. How do I change the font size or even the typeface of the TITLE of the chart? Tha开发者_如何学Cnks.
Steve's answer is correct, alternatively it can be done in C# like this:
yourChart.Titles.Add(
new Title(
"Gross National Rickrolls",
Docking.Top,
new Font("Verdana", 8f, FontStyle.Bold),
Color.Black
)
);
Documentation on:
- the Chart.Titles collection
- the Title Class itself
- the Font Class used above (from the System.Drawing)
Here's a standalone chart with a custom title:
<asp:Chart ID="Chart1" runat="server">
<Titles>
<asp:Title Font="Times New Roman, 12pt, style=Bold, Italic" Name="Title1"
Text="Hello World">
</asp:Title>
</Titles>
<series>
<asp:Series ChartArea="ChartArea1" ChartType="Pie" Name="Series1">
<Points>
<asp:DataPoint XValue="5" YValues="5" />
<asp:DataPoint XValue="4" YValues="4" />
<asp:DataPoint XValue="3" YValues="3" />
</Points>
</asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</chartareas>
</asp:Chart>
精彩评论