VpeChartDataAddXLabel

<< Click to Display Table of Contents >>

Navigation:  Charts >

VpeChartDataAddXLabel

Previous pageReturn to chapter overviewNext page

Adds a new X-Label to the chart. By default, the x-axis is automatically labeled. With VpeSetChartXLabelState() you can switch to user defined labels and then add X-Labels to the chart. (see also VpeSetChartXLabelStartValue())

void VpeChartDataAddXLabel(

VpeHandle hDoc,

VpeHandle hData,

LPCSTR xlabel

)

VpeHandle hDoc

Document Handle

VpeHandle hData

handle of ChartData object

LPCSTR xlabel

string of label to add

Remarks:

You can control if and on what position x-labels are drawn with the following properties:

VpeSetChartXLabelState()

VpeSetChartXGridStep()

VpeSetChartXLabelStep()

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")

 

Now the internal data table of the ChartData 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

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")

 

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