<< Click to Display Table of Contents >> VpeChart |
Creates a chart object at the given position from the given ChartData object. The type of the chart is specified in the parameter chart_type. 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
void VpeChart(
VpeHandle hDoc,
VpeCoord x,
VpeCoord y,
VpeCoord x2,
VpeCoord y2,
VpeHandle hData,
int chart_type
)
VpeHandle hDoc
Document Handle
VpeCoord x, y, x2, y2
position and dimensions of the chart
VpeHandle hData
handle of ChartData object
int chart_type
possible values are:
Constant Name |
Value |
Comment |
VCHART_POINT |
0 |
|
VCHART_LINE |
1 |
|
VCHART_BAR |
2 |
|
VCHART_STACKED_BAR_ABSOLUTE |
3 |
|
VCHART_STACKED_BAR_PERCENT |
4 |
|
VCHART_3D_BAR |
5 |
|
VCHART_3D_STACKED_BAR_ABSOLUTE |
6 |
|
VCHART_3D_STACKED_BAR_PERCENT |
7 |
|
VCHART_PIE |
8 |
|
VCHART_3D_PIE |
9 |
|
VCHART_AREA_ABSOLUTE |
10 |
|
VCHART_AREA_PERCENT |
11 |
|
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:
VpeHandle hData
hData = VpeChartDataCreate(hDoc, 2, 4)
Creates a ChartData object with two columns (for example Apples and Bananas), where each column can hold 4 numeric data values ( = rows).
VpeChartDataAddValue(hDoc, hData, 0, 10)
VpeChartDataAddValue(hDoc, hData, 0, 20)
VpeChartDataAddValue(hDoc, hData, 0, 30)
VpeChartDataAddValue(hDoc, hData, 0, 40)
VpeChartDataAddValue(hDoc, hData, 1, 5)
VpeChartDataAddValue(hDoc, hData, 1, 10)
VpeChartDataAddValue(hDoc, hData, 1, 15)
VpeChartDataAddValue(hDoc, hData, 1, 20)
VpeChartDataAddLegend(hDoc, hData, "Apples")
VpeChartDataAddLegend(hDoc, hData, "Bananas")
VpeSetChartXLabelState(hDoc, VCHART_LABEL_USER)
VpeChartDataAddXLabel(hDoc, hData, "1. Quarter")
VpeChartDataAddXLabel(hDoc, hData, "2. Quarter")
VpeChartDataAddXLabel(hDoc, hData, "3. Quarter")
VpeChartDataAddXLabel(hDoc, hData, "4. Quarter")
Now the internal data table of the ChartData 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:
VpeSetBkgMode(hDoc, VBKG_GRD_LINE)
VpeSetChartTitle(hDoc, "Bar Chart")
VpeChart(hDoc, 1, 1, -18, -18, hData, VCHART_BAR)
VpePageBreak(hDoc)
VpeSetChartTitle(hDoc, "3-D Bar Chart")
VpeChart(hDoc, 1, 1, -18, -18, hData, VCHART_3D_BAR)
VpePageBreak(hDoc)
VpeSetChartTitle(hDoc, "3-D Pie Chart")
VpeSetChartSubTitle(hDoc, "Row 1")
VpeSetChartRow(hDoc, 0)
VpeChart(hDoc, 1, 1, -18, -18, hData, VCHART_3D_PIE)
VpePageBreak(hDoc)
VpeSetChartTitle(hDoc, "3-D Pie Chart")
VpeSetChartSubTitle(hDoc, "Row 2")
VpeSetChartRow(hDoc, 1)
VpeChart(hDoc, 1, 1, -18, -18, hData, VCHART_3D_PIE)