asp.net - 如何在 ZedGraph 中的每个点显示标签?

标签 asp.net charts controls zedgraph

如何为 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);
                }

关于asp.net - 如何在 ZedGraph 中的每个点显示标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/815556/

相关文章:

asp.net - session是保存在客户端还是服务器端

c# - C#和WPF用什么画折线图?

python - 如何在 Python 中捕获 SIGINT?

c# - 如何为鼠标创建一个控件 "transparent"或将MouseMove事件路由到父级?

c# - ASP.NET 如何在特定时间自动发送电子邮件

asp.net - 使用 Azure 在 ASP.net 中流式传输视频的最佳方式是什么?

asp.net - 禁用 Visual Studio 的缓存

Androidplot:创建时间轴

c# - 如何使用C#和.net 4内置图表控件绘制图表?

wpf - 将 WPF 控件调整为精确的百分比