1

I have made a graph and it shows the value every time I move the cursor on any point. I use zedGraphControl1.IsShowPointValues = true; for that.

The problem is the ToolTip that is shown from it is blinking. After looking around on the internet, I found this forum thread: http://sourceforge.net/p/zedgraph/patches/87/

Is there anyone who knows how to use that patch? or is there any other solution?

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Yusril Maulidan Raji
  • 1,682
  • 1
  • 21
  • 46
  • 2
    This has been fixed in the last ZedGraph version available in Nugget. – Larry Aug 25 '16 at 13:04
  • @Larry Well, I didn't know if there is a different version between the one in SourceForge (https://sourceforge.net/projects/zedgraph/files/zedgraph%20dll%20only/) and the one in Nugget (https://www.nuget.org/packages/ZedGraph/). I'll try it next time. Thanks for the info. – Yusril Maulidan Raji Aug 26 '16 at 07:22
  • Thanks Larry, I changed from using an older zedgraph dll to the nuget version and it fixed the show point value blinking bug. – bobasaurus May 02 '18 at 20:43

2 Answers2

0

The patch is a text file,two version's differences file,you can add a file extension as Tooltip_Flicker.patch.cs you can open it with texteditor(eg.Notepad++,Visual studio)

So you need download the source code and modify the file as patch file then rebuild it.Good Luck for you!

The content as follow:

     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
huoxudong125
  • 1,966
  • 2
  • 26
  • 42
  • Sorry, I still dont understand with "modify the file as patch file then rebuild it." I have downloaded it and change the format file into .cs like you said. But when I insert it into my project explorer (visual studio 2010) and rebuild it. It shows many of errors. – Yusril Maulidan Raji Oct 20 '15 at 14:41
  • `+ `means add the line ;`-` means remove the line. you need to modify the file by yourself. then rebuild the project. – huoxudong125 Oct 20 '15 at 14:43
  • `--- source/ZedGraph/ZedGraphControl.Events.cs (revision 451) +++ source/ZedGraph/ZedGraphControl.Events.cs (working copy) @@ -713,15 +713,19 @@` these lines are just additional infomation for you . you can removed them. – huoxudong125 Oct 20 '15 at 14:46
  • So, it means that It's already implemented in the zedgraph then, wasn't it? – Yusril Maulidan Raji Oct 21 '15 at 06:31
  • @YusrilMaulidanRaji it's a bug of zedgraphic. So now you need to fix the bug by yourself. The patch ifle is just a reference for you to fix. – huoxudong125 Oct 22 '15 at 01:01
0

The fix has a flaw. Returning to the same point doesn't display the tool tip. To fix this I replaced every instance in the section of code

this.pointToolTip.Active = false; 

with

{ this.pointToolTip.Active = false; this.pointToolTip.SetToolTip(this, ""); }
ADyson
  • 57,178
  • 14
  • 51
  • 63
Rudy
  • 1