Click here to Skip to main content
15,891,529 members
Articles / Desktop Programming / ATL

A 2D Graph Component With Zoom Capability

Rate me:
Please Sign up or sign in to vote.
4.92/5 (37 votes)
21 Dec 2004CPOL2 min read 289.3K   21.5K   166  
A 2D graph component with zoom capability.
import "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\prsht.idl";
import "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\mshtml.idl";
import "c:\program files\microsoft visual studio .net 2003\vc7\platformsdk\include\dimm.idl";
import "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\mshtmhst.idl";
import "c:\program files\microsoft visual studio .net 2003\vc7\platformsdk\include\docobj.idl";
import "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\exdisp.idl";
import "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\objsafe.idl";

[
	object,
	uuid(1EECA078-14D3-427D-AEA5-F9342ABBFC7C),
	dual,
	helpstring("ISmartGraph Interface"),
	pointer_default(unique)
] 
#line 26 "e:\\mine\\projects\\my articles sent to code project\\smartgraph\\smartgraph.h"
interface ISmartGraph : IDispatch {
#line 29 "e:\\mine\\projects\\my articles sent to code project\\smartgraph\\smartgraph.h"
	[propput,bindable,requestedit,id((-501))] HRESULT  BackColor([in] OLE_COLOR clr);
#line 31 "e:\\mine\\projects\\my articles sent to code project\\smartgraph\\smartgraph.h"
	[propget,bindable,requestedit,id((-501))] HRESULT  BackColor([out,retval] OLE_COLOR *pclr);
#line 33 "e:\\mine\\projects\\my articles sent to code project\\smartgraph\\smartgraph.h"
	[propput,bindable,requestedit,id((-503))] HRESULT  BorderColor([in] OLE_COLOR clr);
#line 35 "e:\\mine\\projects\\my articles sent to code project\\smartgraph\\smartgraph.h"
	[propget,bindable,requestedit,id((-503))] HRESULT  BorderColor([out,retval] OLE_COLOR *pclr);
#line 37 "e:\\mine\\projects\\my articles sent to code project\\smartgraph\\smartgraph.h"
	[propput,bindable,requestedit,id((-513))] HRESULT  ForeColor([in] OLE_COLOR clr);
#line 39 "e:\\mine\\projects\\my articles sent to code project\\smartgraph\\smartgraph.h"
	[propget,bindable,requestedit,id((-513))] HRESULT  ForeColor([out,retval] OLE_COLOR *pclr);
	[propget,id(1),helpstring("property Title")] HRESULT  Title([out,retval] BSTR *pVal );
	[propput,id(1),helpstring("property Title")] HRESULT  Title([in] BSTR newVal);
	[propget,id(2),helpstring("property xLable")] HRESULT  xLable([out,retval] BSTR *pVal );
	[propput,id(2),helpstring("property xLable")] HRESULT  xLable([in] BSTR newVal);
	[propget,id(3),helpstring("property yLable")] HRESULT  yLable([out,retval] BSTR *pVal );
	[propput,id(3),helpstring("property yLable")] HRESULT  yLable([in] BSTR newVal);
	[propget,id(4),helpstring("property Columns")] HRESULT  Columns([out,retval] LONG *pVal);
	[propput,id(4),helpstring("property Columns")] HRESULT  Columns([in] LONG newVal);
	[propget,id(5),helpstring("property Rows")] HRESULT  Rows([out,retval] LONG *pVal);
	[propput,id(5),helpstring("property Rows")] HRESULT  Rows([in] LONG newVal);
	[propget,id(6),helpstring("property MarginBottom")] HRESULT  MarginBottom([out,retval] LONG *pVal);
	[propput,id(6),helpstring("property MarginBottom")] HRESULT  MarginBottom([in] LONG newVal);
	[propget,id(7),helpstring("property MarginTop")] HRESULT  MarginTop([out,retval] LONG *pVal);
	[propput,id(7),helpstring("property MarginTop")] HRESULT  MarginTop([in] LONG newVal);
	[propget,id(8),helpstring("property MarginRight")] HRESULT  MarginRight([out,retval] LONG *pVal);
	[propput,id(8),helpstring("property MarginRight")] HRESULT  MarginRight([in] LONG newVal);
	[propget,id(9),helpstring("property MarginLeft")] HRESULT  MarginLeft([out,retval] LONG *pVal);
	[propput,id(9),helpstring("property MarginLeft")] HRESULT  MarginLeft([in] LONG newVal);
	[id(10),helpstring("method SetData")] HRESULT  SetData([in] DOUBLE *xData, [in] DOUBLE *yData, [in] LONG NumOfPoints, [in] VARIANT_BOOL bResample);
	[id(11),helpstring("method SetDataWithDetail")] HRESULT  SetData2([in] DOUBLE *xData, [in] DOUBLE *yData, [in] LONG NumOfPoints, [in] DOUBLE xMin, [in] DOUBLE xMax, [in] DOUBLE yMin, [in] DOUBLE yMax, [in] VARIANT_BOOL bResample);
#line 61 "e:\\mine\\projects\\my articles sent to code project\\smartgraph\\smartgraph.h"
	[id(12),helpstring("method ShowGrid")] HRESULT  ShowGrid([in] VARIANT_BOOL bShow);
	[id(13),helpstring("method UpdateGraph")] HRESULT  UpdateGraph();
	[id(14),helpstring("method SetPlotType")] HRESULT  SetPlotType([in] LONG nType);
	[id(15),helpstring("method GetPlotRect")] HRESULT  GetPlotRect([out] LONG *left, [out] LONG *top, [out] LONG *right, [out] LONG *bottom);
	[id(16),helpstring("method GetClientRect")] HRESULT  GetClientRect([out] LONG *left, [out] LONG *top, [out] LONG *right, [out] LONG *bottom);
	[id(17),helpstring("method ZoomIn")] HRESULT  ZoomIn([in] LONG FromSample, [in] LONG ToSample);
	[id(18),helpstring("method ZoomInByPercent")] HRESULT  ZoomInByPercent([in] DOUBLE FromPercent, [in] DOUBLE ToPercent);
	[id(19),helpstring("method ZoomOut")] HRESULT  ZoomOut();
	[id(20),helpstring("Resets graph view to original view"),helpcontext(20)] HRESULT  Reset();
	[id(21),helpstring("method GetDisplayedRange")] HRESULT  GetDisplayedRange([out] LONGLONG *nStartSample, [out] LONGLONG *nEndSample);
	[id(22),helpstring("method SetLegendText")] HRESULT  SetLegendText([in] BSTR strText, [in]LONG top, [in]LONG left, [in]LONG bottom, [in]LONG right);
	[id(23),helpstring("method SetParentWnd")] HRESULT  SetParentWnd([in] OLE_HANDLE hWnd);
	[id(24),helpstring("method GetPlotType")] HRESULT  GetPlotType([in]LONG *PlotType);
};


[ version(1.0), uuid(EF8E3F70-D54A-4B7D-A6EB-1D47794BEF45), helpstring("Graph 1.0 Type Library") ]
library Graph
{
	importlib("stdole2.tlb");
	importlib("olepro32.dll");

	[
		uuid(1F12078D-03B2-4C25-84CA-3191E7DF3FFB),
		helpstring("_ISmartGraphEvents Interface")
	] 
#line 84 "e:\\mine\\projects\\my articles sent to code project\\smartgraph\\smartgraph.h"
	dispinterface _ISmartGraphEvents {
	properties:

	methods:
		[id(1),helpstring("method LButtonDown")] HRESULT  LButtonDown([in] LONG xPos, [in]LONG yPos, [in]LONGLONG wParam);
		[id(2),helpstring("method LButtonUp")] HRESULT  LButtonUp([in] LONG xPos, [in]LONG yPos, [in]LONGLONG wParam);
		[id(3),helpstring("method MouseMove")] HRESULT  MouseMove([in] LONG xPos, [in]LONG yPos, [in]LONGLONG wParam);
	};

	[
		version(1.0),
		uuid(A2919A75-B379-4BBD-8D95-15BEB3BAA140),
		helpstring("SmartGraph Class")
	] 
#line 103 "e:\\mine\\projects\\my articles sent to code project\\smartgraph\\smartgraph.h"
	coclass SmartGraph {
		interface ISmartGraph;
		[default, source]	interface _ISmartGraphEvents;
	};

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) https://shahaab-co.com
Iran (Islamic Republic of) Iran (Islamic Republic of)
Currently I'm working at Dept. of Electrical Engineering in University of Shahrood.
Pattern Recognition (specially OCR), Neural Networks, Image Processing and Machine Vision are my interests. However I'm a PROGRAMMER as well.
BSc: Sharif University of technology @ 2002
MSc. and PhD: Tarbiat Modarres University @ 2006 & 2010 respectively

Personal Blog: Andisheh Online

Religious Blogs: Shia Muslims , Islamic Quotes

Company Site: Shahaab-co
My old Site: Farsi OCR

Comments and Discussions