我制作了一个图形,并且每次在任何点上移动光标时都会显示该值。我使用zedGraphControl1.IsShowPointValues = true;
。点值保持闪烁(IsShowPointValues)
问题是显示的工具提示闪烁。在互联网上环顾四周,我发现这个论坛主题: http://sourceforge.net/p/zedgraph/patches/87/
有没有人知道如何使用该补丁? 还是有其他解决方案吗?
我制作了一个图形,并且每次在任何点上移动光标时都会显示该值。我使用zedGraphControl1.IsShowPointValues = true;
。点值保持闪烁(IsShowPointValues)
问题是显示的工具提示闪烁。在互联网上环顾四周,我发现这个论坛主题: http://sourceforge.net/p/zedgraph/patches/87/
有没有人知道如何使用该补丁? 还是有其他解决方案吗?
补丁是一个文本文件中的两个版本的差异文件,你可以添加文件扩展名作为Tooltip_Flicker.patch.cs
你可以用文本编辑打开它(eg.Notepad ++,Visual Studio中)
所以你需要下载源代码,修改文件作为补丁文件,然后重建它。祝你好运!
内容如下:
Index: source/ZedGraph/ZedGraphControl.Events.cs
===================================================================
--- source/ZedGraph/ZedGraphControl.Events.cs (revision 451)
+++ source/ZedGraph/ZedGraphControl.Events.cs (working copy)
@@ -713,15 +713,19 @@
{
if (nearestObj is CurveItem && iPt >= 0)
{
- CurveItem curve = (CurveItem)nearestObj;
+ CurveItem curve = (CurveItem)nearestObj;
+ string label = "";
// Provide Callback for User to customize the tooltips
if (this.PointValueEvent != null)
{
- string label = this.PointValueEvent(this, pane, curve, iPt);
+ label = this.PointValueEvent(this, pane, curve, iPt);
if (label != null && label.Length > 0)
- {
- this.pointToolTip.SetToolTip(this, label);
- this.pointToolTip.Active = true;
+ {
+ if (this.pointToolTip.GetToolTip(this) != label)
+ {
+ this.pointToolTip.SetToolTip(this, label);
+ this.pointToolTip.Active = true;
+ }
}
else
this.pointToolTip.Active = false;
@@ -730,9 +734,8 @@
{
if (curve is PieItem)
- {
- this.pointToolTip.SetToolTip(this,
- ((PieItem)curve).Value.ToString(_pointValueFormat));
+ {
+ label = ((PieItem)curve).Value.ToString(_pointValueFormat);
}
// else if (curve is OHLCBarItem || curve is JapaneseCandleStickItem)
// {
@@ -750,7 +753,7 @@
PointPair pt = curve.Points[iPt];
if (pt.Tag is string)
- this.pointToolTip.SetToolTip(this, (string)pt.Tag);
+ label = (string)pt.Tag;
else
{
double xVal, yVal, lowVal;
@@ -766,14 +769,18 @@
string yStr = MakeValueLabel(curve.GetYAxis(pane), yVal, iPt,
curve.IsOverrideOrdinal);
- this.pointToolTip.SetToolTip(this, "(" + xStr + ", " + yStr + ")");
+ label = string.Format("({0}, {1})", xStr, yStr);
//this.pointToolTip.SetToolTip(this,
// curve.Points[iPt].ToString(this.pointValueFormat));
}
- }
-
- this.pointToolTip.Active = true;
+ }
+
+ if (this.pointToolTip.GetToolTip(this) != label)
+ {
+ this.pointToolTip.SetToolTip(this, label);
+ this.pointToolTip.Active = true;
+ }
}
}
else
@@ -791,15 +798,19 @@
{
GraphPane pane = _masterPane.FindPane(mousePt);
if (pane != null && pane.Chart._rect.Contains(mousePt))
- {
+ {
+ string label = "";
// Provide Callback for User to customize the tooltips
if (this.CursorValueEvent != null)
{
- string label = this.CursorValueEvent(this, pane, mousePt);
+ label = this.CursorValueEvent(this, pane, mousePt);
if (label != null && label.Length > 0)
- {
- this.pointToolTip.SetToolTip(this, label);
- this.pointToolTip.Active = true;
+ {
+ if (this.pointToolTip.GetToolTip(this) != label)
+ {
+ this.pointToolTip.SetToolTip(this, label);
+ this.pointToolTip.Active = true;
+ }
}
else
this.pointToolTip.Active = false;
@@ -812,8 +823,12 @@
string yStr = MakeValueLabel(pane.YAxis, y, -1, true);
string y2Str = MakeValueLabel(pane.Y2Axis, y2, -1, true);
- this.pointToolTip.SetToolTip(this, "(" + xStr + ", " + yStr + ", " + y2Str + ")");
- this.pointToolTip.Active = true;
+ label = string.Format( "({0}, {1}, {2})", xStr, yStr, y2Str);
+ if (this.pointToolTip.GetToolTip(this) != label)
+ {
+ this.pointToolTip.SetToolTip(this, "(" + xStr + ", " + yStr + ", " + y2Str + ")");
+ this.pointToolTip.Active = true;
+ }
}
}
else
对不起,我还是不明白“修改文件作为补丁文件,然后重建它。” 我已经下载它并将格式文件更改为.cs,就像你说的。但是当我将它插入到我的项目资源管理器(Visual Studio 2010)中并重建它时。它显示了很多错误。 –
'+'表示添加该行;'-'表示删除该行。你需要自己修改文件。然后重建该项目。 – huoxudong125
'--- source/ZedGraph/ZedGraphControl.Events.cs(修订版451) +++ source/ZedGraph/ZedGraphControl.Events.cs(工作副本) @@ -713,15 +713,19 @@'这些行只是你的附加信息。你可以删除它们。 – huoxudong125
的修复有一个缺陷。回到同一点不会显示工具提示。为了解决这个问题我的代码
this.pointToolTip.Active = false;
部分代替每个实例有
{ this.pointToolTip.Active = false; this.pointToolTip.SetToolTip(this, ""); }
这已被固定在掘金提供的最后ZedGraph版本。 – Larry
@Larry嗯,我不知道SourceForge(https://sourceforge.net/projects/zedgraph/files/zedgraph%20dll%20only/)中的一个与Nugget中的一个(https ://www.nuget.org/packages/ZedGraph/)。我会在下次尝试。谢谢(你的)信息。 –