Chart

<< Click to Display Table of Contents >>

Navigation:  Charts >

Chart

Previous pageReturn to chapter overviewNext page

Creates a chart object at the given position from the given ChartData object. The type of the chart is specified in the parameter ChartType. All current chart property settings apply to the created chart.

The property TextColor - which is the generic foreground color - specifies the color for the following chart elements:

title, subtitle, footnote

x- / y-axis titles

x- / y-labels

method void VPE.Chart(

VpeCoord Left,

VpeCoord Top,

VpeCoord Right,

VpeCoord Bottom,

TVPEChartData [pointer] hData,

ChartType [integer] ChartType

)

VpeCoord Left, Top, Right, Bottom

position and dimensions of the chart

TVPEChartData [pointer] hData

VCL

handle to ChartData object

all other Control-Types

Chart Data object

ChartType [integer] ChartType

possible values are:

ActiveX / VCL

Value

Enum

VCHART_POINT

0

Point

VCHART_LINE

1

Line

VCHART_BAR

2

Bar

VCHART_STACKED_BAR_ABSOLUTE

3

StackedBarAbsolute

VCHART_STACKED_BAR_PERCENT

4

StackedBarPercent

VCHART_3D_BAR

5

Bar3D

VCHART_3D_STACKED_BAR_ABSOLUTE

6

StackedBar3DAbsolute

VCHART_3D_STACKED_BAR_PERCENT

7

StackedBar3DPercent

VCHART_PIE

8

Pie

VCHART_3D_PIE

9

Pie3D

VCHART_AREA_ABSOLUTE

10

AreaAbsolute

VCHART_AREA_PERCENT

11

AreaPercent

 

Remarks:

VPE offers several methods to attach an object's position to margins and relative to the position of previously inserted objects. In addition Text, Rich Text and Picture objects are able to compute their dimensions automatically depending on their visual content.
For details please see "Dynamic Positioning" in the Programmer's Manual.

 

Example ActiveX, .NET, Java, …:

dim Data as TVPEChartData

Data = Doc.ChartDataCreate(2, 4)

Creates a ChartData object with two columns (for example Apples and Bananas), where each column can hold 4 numeric data values ( = rows).

 

Data.AddValue(0, 10)

Data.AddValue(0, 20)

Data.AddValue(0, 30)

Data.AddValue(0, 40)

Data.AddValue(1, 5)

Data.AddValue(1, 10)

Data.AddValue(1, 15)

Data.AddValue(1, 20)

Data.AddLegend("Apples")

Data.AddLegend("Bananas")

 

Now the internal data table of the Chart Data object will look like this:

 

Column 0

"Apples"

Column 1

"Bananas"

row 0

10

5

row 1

20

10

row 2

30

15

row 3

40

20

 

With the following code

Doc.ChartXLabelState = ChartLabelState.User

Data.AddXLabel("1. Quarter")

Data.AddXLabel("2. Quarter")

Data.AddXLabel("3. Quarter")

Data.AddXLabel("4. Quarter")

 

the internal data table of the Chart Data object will look like this:


Column 0

"Apples"

Column 1

"Bananas"

row 0 "1. Quarter"

10

5

row 1 "2. Quarter"

20

10

row 2 "3. Quarter"

30

15

row 3 "4. Quarter"

40

20

 

Now some different charts are created from the same ChartData object:

Doc.BkgMode = BkgMode.GradientLine

Doc.ChartTitle = "Bar Chart"

Doc.Chart(1, 1, -18, -18, Data, ChartType.Bar)

Doc.PageBreak()

 

Doc.ChartTitle = "3-D Bar Chart"

Doc.Chart(1, 1, -18, -18, Data, ChartType.Bar3D)

Doc.PageBreak()

 

Doc.ChartTitle = "3-D Pie Chart"

Doc.ChartSubTitle = "Row 1"

Doc.ChartRow = 0

Doc.Chart(1, 1, -18, -18, Data, ChartType.Pie3D)

Doc.PageBreak()

 

Doc.ChartTitle "3-D Pie Chart"

Doc.ChartSubTitle = "Row 2"

Doc.ChartRow = 1

Doc.Chart(1, 1, -18, -18, Data, ChartType.Pie3D)

 

 

Example VCL:

hData: Pointer

hData = Doc.ChartDataCreate(2, 4)

Creates a ChartData object with two columns (for example Apples and Bananas), where each column can hold 4 numeric data values ( = rows).

 

Doc.ChartDataAddValue(hData, 0, 10)

Doc.ChartDataAddValue(hData, 0, 20)

Doc.ChartDataAddValue(hData, 0, 30)

Doc.ChartDataAddValue(hData, 0, 40)

Doc.ChartDataAddValue(hData, 1, 5)

Doc.ChartDataAddValue(hData, 1, 10)

Doc.ChartDataAddValue(hData, 1, 15)

Doc.ChartDataAddValue(hData, 1, 20)

Doc.ChartDataAddLegend(hData, "Apples")

Doc.ChartDataAddLegend(hData, "Bananas")

 

Now the internal data table of the Chart Data object will look like this:

 

Column 0

"Apples"

Column 1

"Bananas"

row 0

10

5

row 1

20

10

row 2

30

15

row 3

40

20

 

With the following code

Doc.ChartXLabelState = VCHART_LABEL_USER

Doc.ChartDataAddXLabel(hData, "1. Quarter")

Doc.ChartDataAddXLabel(hData, "2. Quarter")

Doc.ChartDataAddXLabel(hData, "3. Quarter")

Doc.ChartDataAddXLabel(hData, "4. Quarter")

 

the internal data table of the Chart Data object will look like this:


Column 0

"Apples"

Column 1

"Bananas"

row 0 "1. Quarter"

10

5

row 1 "2. Quarter"

20

10

row 2 "3. Quarter"

30

15

row 3 "4. Quarter"

40

20

 

Now some different charts are created from the same ChartData object:

Doc.BkgMode = VBKG_GRD_LINE

Doc.ChartTitle = "Bar Chart"

Doc.Chart(1, 1, -18, -18, hData, VCHART_BAR)

Doc.PageBreak()

 

Doc.ChartTitle = "3-D Bar Chart"

Doc.Chart(1, 1, -18, -18, hData, VCHART_3D_BAR)

Doc.PageBreak()

 

Doc.ChartTitle = "3-D Pie Chart"

Doc.ChartSubTitle = "Row 1"

Doc.ChartRow = 0

Doc.Chart(1, 1, -18, -18, hData, VCHART_3D_PIE)

Doc.PageBreak()

 

Doc.ChartTitle "3-D Pie Chart"

Doc.ChartSubTitle = "Row 2"

Doc.ChartRow = 1

Doc.Chart(1, 1, -18, -18, hData, VCHART_3D_PIE)