2012-05-24 29 views
0

我目前正在使用下面顯示的代碼格式化我的圖表系列點系列,但我沒有看到任何方法來更改點標籤文本的字體。 有誰知道在哪裏訪問點標籤的字體屬性?asp.net圖表系列點標籤字體格式

'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 

回答

1

你應該看到它在這裏

pt.Font 

我在C#中使用的實際代碼是

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

聲明一個新的字體,並使用:

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

然後設置你的數據點的字體屬性:

pt.font = myFont;