【问题标题】:How to display labels in each point in ZedGraph?如何在 ZedGraph 中的每个点显示标签?
【发布时间】:2009-05-02 20:32:39
【问题描述】:

如何为 ZedGraph 图表中绘制的每个点显示标签?

【问题讨论】:

    标签: asp.net charts controls zedgraph


    【解决方案1】:

    由于该站点现在已关闭,这里有一个代码 sn-p 来举例说明如何做到这一点:

    myLine.GetRange(out other, out other, out minY, out maxY, false, false, myPane);
                    double Yinterval = Math.Abs(maxY - minY) / 25;
                    // Loop to add text labels to the points
                    for (int i = 0; i < tempPoints.Count; i++) {
                        // Get the pointpair
                        ZedGraph.PointPair pt = tempPoints[i];
                        // Create a text label from the Y data value
                        ZedGraph.TextObj text = new ZedGraph.TextObj(pt.Y.ToString(), pt.X, pt.Y + Yinterval,
                            ZedGraph.CoordType.AxisXYScale, ZedGraph.AlignH.Left, ZedGraph.AlignV.Center);
                        text.FontSpec.FontColor = tempHolder.Color;
                        text.ZOrder = ZedGraph.ZOrder.A_InFront;
                        // Hide the border and the fill
                        text.FontSpec.Border.IsVisible = false;
                        text.FontSpec.Fill.IsVisible = false;
                        text.FontSpec.Size = 10f;
                        text.FontSpec.Angle = 45;
    
    
                        string lblString = "name";
    
                        Link lblLink = new Link(lblString, "#", "");
                        text.Link = lblLink;
    
                        myPane.GraphObjList.Add(text);
                    }
    

    【讨论】:

      【解决方案2】:

      对于每个点,使用您的标签文本创建一个文本对象,并将其添加到图表中。

      Point Label Demo 演示...

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-10-09
        • 2010-10-23
        • 1970-01-01
        • 1970-01-01
        • 2017-05-03
        • 2017-07-12
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多