Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net & .Net Compact Framework
 QCChart2D and QCChart2D CF (VB and C#)
 Data Tool Tip with respect to x axis data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

new

14 Posts

Posted - 29 Sep 2006 :  04:23:07  Show Profile  Reply with Quote
Hello
In stacked graphs of CustomDataTooltips example data tool tip is poping up whenever we click on any one oth PLOTs..
if we click on a blank area(white space where there is no plot) datatool tip is not poping up..
Is it possible to show this tooltip even if we click on such blank area?... may be with respect to valid x axis value..

with regard

quinncurtis

1164 Posts

Posted - 29 Sep 2006 :  09:00:41  Show Profile  Reply with Quote
We added the else block below to the OnMouseDown method

public override void  OnMouseDown (MouseEventArgs mouseevent)
{
  Point2D mousepos = new Point2D();
  mousepos.SetLocation(mouseevent.X, mouseevent.Y); 
  base.OnMouseDown(mouseevent);
  
  ChartPlot selectedPlot =  (ChartPlot) GetSelectedPlotObj();
  if (selectedPlot != null)
  {
           .
           . // Original code, leave in place
           .

  } 
 else
{
	Point2D physcoord = currentInstance.pTransform0.ConvertCoord(PHYS_POS, mousepos, DEV_POS);
	stockpanel.SetChartObjScale(currentInstance.pTransform0);
	stockpanel.SetLocation( mousepos, ChartObj.DEV_POS);
	// Looking to the original arrays, because we just have the selectedindex, 

	ChartCalendar x =  new ChartCalendar();
	x.SetCalendarMsecs((long) physcoord.X);

	marker = new Marker(currentInstance.pTransform0,ChartObj.MARKER_VLINE,x.GetCalendarMsecs(),0,1,ChartObj.PHYS_POS);
	TimeLabel timelabel = new TimeLabel(currentInstance.pTransform0, x, ChartObj.TIMEDATEFORMAT_24HMS);
					
	stockpanel.SetTextString(timelabel.GetTextString());
	stockpanel.SetChartObjEnable(ChartObj.OBJECT_ENABLE);
   //	Graphics g2 = GetToolTipGraphics();
	Graphics g2 = (Graphics) currentInstance.CreateGraphics();

	// Precalculates the text bounding box so that the size is
	// known before it is drawn        
	stockpanel.PreCalcTextBoundingBox(g2); 
	Rectangle2D boundingbox = stockpanel.GetTextBox();
	// Reposition tooltip text box if top of box near top of graph window
	// You can do the same thing for all four sides of the graph window
	if (  (mousepos.GetY() - boundingbox.GetHeight()) < 1)
	{
		mousepos.SetLocation(mousepos.GetX(), mousepos.GetY() + boundingbox.GetHeight());
		stockpanel.SetLocation( mousepos, ChartObj.DEV_POS);
	}   
	// Draws the tooltip text panel to the chart graphics context  
	stockpanel.SetTextNudge(10, -10);
	stockpanel.Draw(g2); 
	marker.Draw(g2);
	if (g2 != null)
		g2.Dispose();
}
Go to Top of Page

new

14 Posts

Posted - 29 Sep 2006 :  09:45:39  Show Profile  Reply with Quote
hello
i just copied the code and pasted in example but
error is comming on line
stockpanel.PreCalcTextBoundingBox(g2);
as
System.NullReferenceException was unhandled

regards
Go to Top of Page

quinncurtis

1164 Posts

Posted - 29 Sep 2006 :  10:18:17  Show Profile  Reply with Quote
The original code didn't work unless you selected a plot object first, and then started selecting off of the plot objects, because the call to the GetToolTipGraphics function doesn't return a valid Graphics object unless an object is selected first.

The code has been changed to create, use, and dispose, a new Graphics object, instead of relying on the GetToolTipGraphics call. The code in the original else block has been changed to reflect this change.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07