English 中文(简体)
asp.net 图表序列符号点标签字体格式
原标题:asp.net chart series point label font formats

I am currently formatting my chart series point series with the code shown below but I don t see any way to change the font for the point label text. Does anyone know where to access the font attributes for the point labels?

 set the series point color dependent on value and retrieve the best & worst values
    Dim bestval As Double = 0.0
    Dim worstval As Double = 0.0
    For Each pt As DataPoint In cht.Series("MonthPL").Points
         pt.IsValueShownAsLabel = True
        pt.Label = "#VALY{C0}"
        pt.LabelToolTip = "#AXISLABEL  s P/L is #VALY{C0}"
        If pt.YValues(0) < 0 Then
            If pt.YValues(0) < worstval Then worstval = pt.YValues(0)
            pt.Color = Color.Red
            pt.LabelForeColor = Color.Black
        Else
            If pt.YValues(0) > bestval Then bestval = pt.YValues(0)
            pt.Color = Color.DarkGreen
            pt.LabelForeColor = Color.GhostWhite
        End If
    Next
问题回答

你在这里看看吧

pt.Font

C#中我实际使用的代码是

Chart1.Series[0].Points[0].Font

声明新字体, 使用如下字体 :

Font myFont = new Font(FontFamily.Generic.SansSerif, 14, FontStyle.Bold);

然后设置您数据点的字体属性 :

pt.font = myFont;

在序列标签中添加 Font= "苏黎世 BT, 11pt, 样式=粗体"





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签