asp.net图表系列点标签字体格式

问题描述 投票:0回答:3

我目前正在使用下面显示的代码来格式化图表系列的点系列,但是我看不到任何更改点标签文本字体的方法。有人知道哪里可以访问点标签的字体属性吗?

'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
asp.net mschart labels series
3个回答
1
投票

您应该在这里看到它

pt.Font

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

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

0
投票

声明新字体,并使用它:

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

然后将数据点的font属性设置为:

pt.font = myFont;

0
投票

添加为Font =“ Zurich BT,11pt,style = Bold”的系列标签

© www.soinside.com 2019 - 2024. All rights reserved.