简体   繁体   English

Zedgraph上的格式化工具提示

[英]Formatting tooltip on Zedgraph

I want to format my tool tip that I used to display graph and point information on PointValueEvent on Zedgraph. 我想格式化我用来在Zedgraph的PointValueEvent上显示图形和点信息的工具提示。

I know how to format normal tool tip but in this case zedgraph doesn't have tool tip property. 我知道如何格式化普通工具提示,但在这种情况下,zedgraph没有工具提示属性。 Point value event automatically shows tool tip. 点值事件自动显示工具提示。

How to formatt that tool tip? 如何格式化该工具提示?

There are a couple of different ways of doing this. 有两种不同的方法可以做到这一点。

Option 1 is to use the PointPair's Tag property when setting up your data. 选项1是在设置数据时使用PointPair的Tag属性。 If the Tag is a string, it will be displayed as a tooltip for the point. 如果标签是一个字符串,它将显示为该点的工具提示。

PointPair pp = new PointPair(....);
pp.Tag = "This is a custom tooltip";

Option 2 is to subscribe to the graph control's PointValueEvent and provide a custom value in your event handler. 选项2是订阅图形控件的PointValueEvent并在事件处理程序中提供自定义值。

graph.PointValueEvent += OnPointValueRequested;
...
private string OnPointValueRequested(object sender, GraphPane pane, CurveItem curve, int pointIndex)
{
    PointPair point= curve[pointIndex];
    string tooltip = String.Format("({0}, {1})", point.X point.Y);
    return tooltip;
}

Also keep in mind that there is a bug with tooltip CPU usage on Vista and above. 另外请记住,在Vista及更高版本上,工具提示CPU使用率存在错误 You may need to patch your copy of ZedGraph to fix it if you haven't already done so. 如果您尚未修补ZedGraph的副本,则可能需要对其进行修补。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM