문제

Zedgraph 차트에 표시된 각 지점에 대한 레이블을 어떻게 표시 할 수 있습니까?

도움이 되었습니까?

해결책

각 지점마다 레이블 텍스트가있는 텍스트 객체를 만들고 그래프에 추가하십시오.

그만큼 포인트 레이블 데모 시연 ...

다른 팁

해당 사이트가 지금 다운되었으므로 다음을 수행하는 방법에 대한 예를 제공하는 코드 스 니펫이 있습니다.

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);
                }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top