ChartDataAddXLabel

<< Click to Display Table of Contents >>

Navigation:  Charts >

ChartDataAddXLabel

Previous pageReturn to chapter overviewNext page

[VCL only]

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

method void VPE.ChartDataAddXLabel(

pointer hData,

string XLabel

)

pointer hData

handle to ChartData object

string XLabel

string of label to add

Remarks:

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

ChartXLabelState

ChartXGridStep

ChartXLabelStep

Example:

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