exgraph - sample code

Add multiple series into the same view?

VBA (MS Access, Excell...)

With Graph1
	.BeginUpdate 
	.AutoFit = True
	With .CategoryAxis
		.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
		.MajorGridLines.Color = "lightgray"
	End With
	With .Series
		With .Add("4600,1300,747,579,0,422,42")
			.Name = "Population"
			.Type = "Line"
			.Misc(6) = 3
		End With
		With .Add("4458,3037,1018,2470,1784,1018,856")
			.Name = "Area"
			.Type = "Column"
		End With
	End With
	.Legend.Visible = True
	.EndUpdate 
End With

VB6

With Graph1
	.BeginUpdate 
	.AutoFit = True
	With .CategoryAxis
		.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
		.MajorGridLines.Color = "lightgray"
	End With
	With .Series
		With .Add("4600,1300,747,579,0,422,42")
			.Name = "Population"
			.Type = "Line"
			.Misc(exLineSize) = 3
		End With
		With .Add("4458,3037,1018,2470,1784,1018,856")
			.Name = "Area"
			.Type = "Column"
		End With
	End With
	.Legend.Visible = True
	.EndUpdate 
End With

VB.NET

With Exgraph1
	.BeginUpdate()
	.AutoFit = True
	With .CategoryAxis
		.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
		.MajorGridLines.Color = "lightgray"
	End With
	With .Series
		With .Add("4600,1300,747,579,0,422,42")
			.Name = "Population"
			.Type = "Line"
			.set_Misc(exontrol.EXGRAPHLib.SerieMiscEnum.exLineSize,3)
		End With
		With .Add("4458,3037,1018,2470,1784,1018,856")
			.Name = "Area"
			.Type = "Column"
		End With
	End With
	.Legend.Visible = True
	.EndUpdate()
End With

VB.NET for /COM

With AxGraph1
	.BeginUpdate()
	.AutoFit = True
	With .CategoryAxis
		.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
		.MajorGridLines.Color = "lightgray"
	End With
	With .Series
		With .Add("4600,1300,747,579,0,422,42")
			.Name = "Population"
			.Type = "Line"
			.Misc(EXGRAPHLib.SerieMiscEnum.exLineSize) = 3
		End With
		With .Add("4458,3037,1018,2470,1784,1018,856")
			.Name = "Area"
			.Type = "Column"
		End With
	End With
	.Legend.Visible = True
	.EndUpdate()
End With

C++

/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXGRAPHLib' for the library: 'ExGraph 1.0 Control Library'

	#import <ExGraph.dll>
	using namespace EXGRAPHLib;
*/
EXGRAPHLib::IGraphPtr spGraph1 = GetDlgItem(IDC_GRAPH1)->GetControlUnknown();
spGraph1->BeginUpdate();
spGraph1->PutAutoFit(VARIANT_TRUE);
EXGRAPHLib::ICategoryAxisPtr var_CategoryAxis = spGraph1->GetCategoryAxis();
	var_CategoryAxis->PutCategories("Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania");
	var_CategoryAxis->GetMajorGridLines()->PutColor("lightgray");
EXGRAPHLib::ISeriesPtr var_Series = spGraph1->GetSeries();
	EXGRAPHLib::ISeriePtr var_Serie = var_Series->Add("4600,1300,747,579,0,422,42",vtMissing);
		var_Serie->PutName(L"Population");
		var_Serie->PutType(L"Line");
		var_Serie->PutMisc(EXGRAPHLib::exLineSize,long(3));
	EXGRAPHLib::ISeriePtr var_Serie1 = var_Series->Add("4458,3037,1018,2470,1784,1018,856",vtMissing);
		var_Serie1->PutName(L"Area");
		var_Serie1->PutType(L"Column");
spGraph1->GetLegend()->PutVisible(VARIANT_TRUE);
spGraph1->EndUpdate();

C++ Builder

Graph1->BeginUpdate();
Graph1->AutoFit = true;
Exgraphlib_tlb::ICategoryAxisPtr var_CategoryAxis = Graph1->CategoryAxis;
	var_CategoryAxis->set_Categories(TVariant("Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"));
	var_CategoryAxis->MajorGridLines->set_Color(TVariant("lightgray"));
Exgraphlib_tlb::ISeriesPtr var_Series = Graph1->Series;
	Exgraphlib_tlb::ISeriePtr var_Serie = var_Series->Add(TVariant("4600,1300,747,579,0,422,42"),TNoParam());
		var_Serie->Name = L"Population";
		var_Serie->Type = L"Line";
		var_Serie->set_Misc(Exgraphlib_tlb::SerieMiscEnum::exLineSize,TVariant(3));
	Exgraphlib_tlb::ISeriePtr var_Serie1 = var_Series->Add(TVariant("4458,3037,1018,2470,1784,1018,856"),TNoParam());
		var_Serie1->Name = L"Area";
		var_Serie1->Type = L"Column";
Graph1->Legend->Visible = true;
Graph1->EndUpdate();

C#

exgraph1.BeginUpdate();
exgraph1.AutoFit = true;
exontrol.EXGRAPHLib.CategoryAxis var_CategoryAxis = exgraph1.CategoryAxis;
	var_CategoryAxis.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania";
	var_CategoryAxis.MajorGridLines.Color = "lightgray";
exontrol.EXGRAPHLib.Series var_Series = exgraph1.Series;
	exontrol.EXGRAPHLib.Serie var_Serie = var_Series.Add("4600,1300,747,579,0,422,42",null);
		var_Serie.Name = "Population";
		var_Serie.Type = "Line";
		var_Serie.set_Misc(exontrol.EXGRAPHLib.SerieMiscEnum.exLineSize,3);
	exontrol.EXGRAPHLib.Serie var_Serie1 = var_Series.Add("4458,3037,1018,2470,1784,1018,856",null);
		var_Serie1.Name = "Area";
		var_Serie1.Type = "Column";
exgraph1.Legend.Visible = true;
exgraph1.EndUpdate();

JScript/JavaScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:FE177A66-2B4E-48E1-ADAD-E5C17BE47660" id="Graph1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	Graph1.BeginUpdate();
	Graph1.AutoFit = true;
	var var_CategoryAxis = Graph1.CategoryAxis;
		var_CategoryAxis.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania";
		var_CategoryAxis.MajorGridLines.Color = "lightgray";
	var var_Series = Graph1.Series;
		var var_Serie = var_Series.Add("4600,1300,747,579,0,422,42",null);
			var_Serie.Name = "Population";
			var_Serie.Type = "Line";
			var_Serie.Misc(6) = 3;
		var var_Serie1 = var_Series.Add("4458,3037,1018,2470,1784,1018,856",null);
			var_Serie1.Name = "Area";
			var_Serie1.Type = "Column";
	Graph1.Legend.Visible = true;
	Graph1.EndUpdate();
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:FE177A66-2B4E-48E1-ADAD-E5C17BE47660" id="Graph1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With Graph1
		.BeginUpdate 
		.AutoFit = True
		With .CategoryAxis
			.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
			.MajorGridLines.Color = "lightgray"
		End With
		With .Series
			With .Add("4600,1300,747,579,0,422,42")
				.Name = "Population"
				.Type = "Line"
				.Misc(6) = 3
			End With
			With .Add("4458,3037,1018,2470,1784,1018,856")
				.Name = "Area"
				.Type = "Column"
			End With
		End With
		.Legend.Visible = True
		.EndUpdate 
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

axGraph1.BeginUpdate();
axGraph1.AutoFit = true;
EXGRAPHLib.CategoryAxis var_CategoryAxis = axGraph1.CategoryAxis;
	var_CategoryAxis.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania";
	var_CategoryAxis.MajorGridLines.Color = "lightgray";
EXGRAPHLib.Series var_Series = axGraph1.Series;
	EXGRAPHLib.Serie var_Serie = var_Series.Add("4600,1300,747,579,0,422,42",null);
		var_Serie.Name = "Population";
		var_Serie.Type = "Line";
		var_Serie.set_Misc(EXGRAPHLib.SerieMiscEnum.exLineSize,3);
	EXGRAPHLib.Serie var_Serie1 = var_Series.Add("4458,3037,1018,2470,1784,1018,856",null);
		var_Serie1.Name = "Area";
		var_Serie1.Type = "Column";
axGraph1.Legend.Visible = true;
axGraph1.EndUpdate();

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_CategoryAxis,com_GridLinesOptions,com_Serie,com_Serie1,com_Series;
	anytype var_CategoryAxis,var_GridLinesOptions,var_Serie,var_Serie1,var_Series;
	;

	super();

	exgraph1.BeginUpdate();
	exgraph1.AutoFit(true);
	var_CategoryAxis = exgraph1.CategoryAxis(); com_CategoryAxis = var_CategoryAxis;
		com_CategoryAxis.Categories("Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania");
		var_GridLinesOptions = COM::createFromObject(com_CategoryAxis.MajorGridLines()); com_GridLinesOptions = var_GridLinesOptions;
		com_GridLinesOptions.Color("lightgray");
	var_Series = exgraph1.Series(); com_Series = var_Series;
		var_Serie = com_Series.Add("4600,1300,747,579,0,422,42"); com_Serie = var_Serie;
			com_Serie.Name("Population");
			com_Serie.Type("Line");
			com_Serie.Misc(6/*exLineSize*/,COMVariant::createFromInt(3));
		var_Serie1 = com_Series.Add("4458,3037,1018,2470,1784,1018,856"); com_Serie1 = var_Serie1;
			com_Serie1.Name("Area");
			com_Serie1.Type("Column");
	exgraph1.Legend().Visible(true);
	exgraph1.EndUpdate();
}

Delphi 8 (.NET only)

with AxGraph1 do
begin
	BeginUpdate();
	AutoFit := True;
	with CategoryAxis do
	begin
		Categories := 'Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania';
		MajorGridLines.Color := 'lightgray';
	end;
	with Series do
	begin
		with Add('4600,1300,747,579,0,422,42',Nil) do
		begin
			Name := 'Population';
			Type := 'Line';
			Misc[EXGRAPHLib.SerieMiscEnum.exLineSize] := TObject(3);
		end;
		with Add('4458,3037,1018,2470,1784,1018,856',Nil) do
		begin
			Name := 'Area';
			Type := 'Column';
		end;
	end;
	Legend.Visible := True;
	EndUpdate();
end

Delphi (standard)

with Graph1 do
begin
	BeginUpdate();
	AutoFit := True;
	with CategoryAxis do
	begin
		Categories := 'Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania';
		MajorGridLines.Color := 'lightgray';
	end;
	with Series do
	begin
		with Add('4600,1300,747,579,0,422,42',Null) do
		begin
			Name := 'Population';
			Type := 'Line';
			Misc[EXGRAPHLib_TLB.exLineSize] := OleVariant(3);
		end;
		with Add('4458,3037,1018,2470,1784,1018,856',Null) do
		begin
			Name := 'Area';
			Type := 'Column';
		end;
	end;
	Legend.Visible := True;
	EndUpdate();
end

VFP

with thisform.Graph1
	.BeginUpdate
	.AutoFit = .T.
	with .CategoryAxis
		.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
		.MajorGridLines.Color = "lightgray"
	endwith
	with .Series
		with .Add("4600,1300,747,579,0,422,42")
			.Name = "Population"
			.Type = "Line"
			.Misc(6) = 3
		endwith
		with .Add("4458,3037,1018,2470,1784,1018,856")
			.Name = "Area"
			.Type = "Column"
		endwith
	endwith
	.Legend.Visible = .T.
	.EndUpdate
endwith

dBASE Plus

local oGraph,var_CategoryAxis,var_Serie,var_Serie1,var_Series

oGraph = form.EXGRAPHACTIVEXCONTROL1.nativeObject
oGraph.BeginUpdate()
oGraph.AutoFit = true
var_CategoryAxis = oGraph.CategoryAxis
	var_CategoryAxis.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
	var_CategoryAxis.MajorGridLines.Color = "lightgray"
var_Series = oGraph.Series
	var_Serie = var_Series.Add("4600,1300,747,579,0,422,42")
		var_Serie.Name = "Population"
		var_Serie.Type = "Line"
		// var_Serie.Misc(6) = 3
		with (oGraph)
			TemplateDef = [dim var_Serie]
			TemplateDef = var_Serie
			Template = [var_Serie.Misc(6) = 3]
		endwith
	var_Serie1 = var_Series.Add("4458,3037,1018,2470,1784,1018,856")
		var_Serie1.Name = "Area"
		var_Serie1.Type = "Column"
oGraph.Legend.Visible = true
oGraph.EndUpdate()

XBasic (Alpha Five)

Dim oGraph as P
Dim var_CategoryAxis as P
Dim var_Serie as P
Dim var_Serie1 as P
Dim var_Series as P

oGraph = topparent:CONTROL_ACTIVEX1.activex
oGraph.BeginUpdate()
oGraph.AutoFit = .t.
var_CategoryAxis = oGraph.CategoryAxis
	var_CategoryAxis.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
	var_CategoryAxis.MajorGridLines.Color = "lightgray"
var_Series = oGraph.Series
	var_Serie = var_Series.Add("4600,1300,747,579,0,422,42")
		var_Serie.Name = "Population"
		var_Serie.Type = "Line"
		' var_Serie.Misc(6) = 3
		oGraph.TemplateDef = "dim var_Serie"
		oGraph.TemplateDef = var_Serie
		oGraph.Template = "var_Serie.Misc(6) = 3"

	var_Serie1 = var_Series.Add("4458,3037,1018,2470,1784,1018,856")
		var_Serie1.Name = "Area"
		var_Serie1.Type = "Column"
oGraph.Legend.Visible = .t.
oGraph.EndUpdate()

Visual Objects

local var_CategoryAxis as ICategoryAxis
local var_Serie,var_Serie1 as ISerie
local var_Series as ISeries

oDCOCX_Exontrol1:BeginUpdate()
oDCOCX_Exontrol1:AutoFit := true
var_CategoryAxis := oDCOCX_Exontrol1:CategoryAxis
	var_CategoryAxis:Categories := "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
	var_CategoryAxis:MajorGridLines:Color := "lightgray"
var_Series := oDCOCX_Exontrol1:Series
	var_Serie := var_Series:Add("4600,1300,747,579,0,422,42",nil)
		var_Serie:Name := "Population"
		var_Serie:Type := "Line"
		var_Serie:[Misc,exLineSize] := 3
	var_Serie1 := var_Series:Add("4458,3037,1018,2470,1784,1018,856",nil)
		var_Serie1:Name := "Area"
		var_Serie1:Type := "Column"
oDCOCX_Exontrol1:Legend:Visible := true
oDCOCX_Exontrol1:EndUpdate()

PowerBuilder

OleObject oGraph,var_CategoryAxis,var_Serie,var_Serie1,var_Series

oGraph = ole_1.Object
oGraph.BeginUpdate()
oGraph.AutoFit = true
var_CategoryAxis = oGraph.CategoryAxis
	var_CategoryAxis.Categories = "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
	var_CategoryAxis.MajorGridLines.Color = "lightgray"
var_Series = oGraph.Series
	var_Serie = var_Series.Add("4600,1300,747,579,0,422,42")
		var_Serie.Name = "Population"
		var_Serie.Type = "Line"
		var_Serie.Misc(6,3)
	var_Serie1 = var_Series.Add("4458,3037,1018,2470,1784,1018,856")
		var_Serie1.Name = "Area"
		var_Serie1.Type = "Column"
oGraph.Legend.Visible = true
oGraph.EndUpdate()

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Send ComBeginUpdate
	Set ComAutoFit to True
	Variant voCategoryAxis
	Get ComCategoryAxis to voCategoryAxis
	Handle hoCategoryAxis
	Get Create (RefClass(cComCategoryAxis)) to hoCategoryAxis
	Set pvComObject of hoCategoryAxis to voCategoryAxis
		Set ComCategories of hoCategoryAxis to "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
		Variant voGridLinesOptions
		Get ComMajorGridLines of hoCategoryAxis to voGridLinesOptions
		Handle hoGridLinesOptions
		Get Create (RefClass(cComGridLinesOptions)) to hoGridLinesOptions
		Set pvComObject of hoGridLinesOptions to voGridLinesOptions
			Set ComColor of hoGridLinesOptions to "lightgray"
		Send Destroy to hoGridLinesOptions
	Send Destroy to hoCategoryAxis
	Variant voSeries
	Get ComSeries to voSeries
	Handle hoSeries
	Get Create (RefClass(cComSeries)) to hoSeries
	Set pvComObject of hoSeries to voSeries
		Variant voSerie
		Get ComAdd of hoSeries "4600,1300,747,579,0,422,42" Nothing to voSerie
		Handle hoSerie
		Get Create (RefClass(cComSerie)) to hoSerie
		Set pvComObject of hoSerie to voSerie
			Set ComName of hoSerie to "Population"
			Set ComType of hoSerie to "Line"
			Set ComMisc of hoSerie OLEexLineSize to 3
		Send Destroy to hoSerie
		Variant voSerie1
		Get ComAdd of hoSeries "4458,3037,1018,2470,1784,1018,856" Nothing to voSerie1
		Handle hoSerie1
		Get Create (RefClass(cComSerie)) to hoSerie1
		Set pvComObject of hoSerie1 to voSerie1
			Set ComName of hoSerie1 to "Area"
			Set ComType of hoSerie1 to "Column"
		Send Destroy to hoSerie1
	Send Destroy to hoSeries
	Variant voLegend
	Get ComLegend to voLegend
	Handle hoLegend
	Get Create (RefClass(cComLegend)) to hoLegend
	Set pvComObject of hoLegend to voLegend
		Set ComVisible of hoLegend to True
	Send Destroy to hoLegend
	Send ComEndUpdate
End_Procedure

XBase++

#include "AppEvent.ch"
#include "ActiveX.ch"

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oGraph
	LOCAL oCategoryAxis
	LOCAL oSerie,oSerie1
	LOCAL oSeries

	oForm := XbpDialog():new( AppDesktop() )
	oForm:drawingArea:clipChildren := .T.
	oForm:create( ,,{100,100}, {640,480},, .F. )
	oForm:close  := {|| PostAppEvent( xbeP_Quit )}

	oGraph := XbpActiveXControl():new( oForm:drawingArea )
	oGraph:CLSID  := "Exontrol.Graph.1" /*{FE177A66-2B4E-48E1-ADAD-E5C17BE47660}*/
	oGraph:create(,, {10,60},{610,370} )

		oGraph:BeginUpdate()
		oGraph:AutoFit := .T.
		oCategoryAxis := oGraph:CategoryAxis()
			oCategoryAxis:Categories := "Asia,Africa,Europe,North America,Antarctica,South America,Australia/Oceania"
			oCategoryAxis:MajorGridLines():Color := "lightgray"
		oSeries := oGraph:Series()
			oSerie := oSeries:Add("4600,1300,747,579,0,422,42")
				oSerie:Name := "Population"
				oSerie:Type := "Line"
				oSerie:SetProperty("Misc",6/*exLineSize*/,3)
			oSerie1 := oSeries:Add("4458,3037,1018,2470,1784,1018,856")
				oSerie1:Name := "Area"
				oSerie1:Type := "Column"
		oGraph:Legend():Visible := .T.
		oGraph:EndUpdate()

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN