---
title: "Description of Chart"
canonical: "https://docs.cuesystem.com/space/CVCGC/825065479/Description%20of%20Chart"
format: markdown
---
The chart object allows you to visualize the data. The data is set into the object by the SetChartData function, which sets both the data and the graphical display. There are 3 types of charts you can use.

CHART_TYPE_BAR

![image](media://e098d8fc-0350-4499-9b4d-dcd4d74702e9)

CHART_TYPE_LINE

![image](media://bf6126b1-c4f2-41ee-bac8-43b79908e306)

CHART_TYPE_LINE_AREA

![image](media://02436af6-5859-4210-a09c-8321cbedb355)

# Properties

Size and position settings are the same as in other graphic objects. The default size is 1200x500 pixels.

# Functions

## SetChartData

This function sets ChartData to newchartdata. The function returns True on success or False if an error occurs.

#### Syntax 

```
Function SetChartData(newchartdata As ChartDataStructure) As Boolean
```

[Descriptions of structures](https://cue.atlassian.net/wiki/spaces/CVCGC/pages/825065479/Description+of+Chart#Descriptions-of-structure) 

## GetChartData

This function returns chartdata.

#### Syntax 

```
Function GetChartData(ByRef chartdata As ChartDataStructure) As Boolean
```

[Descriptions of structures](https://cue.atlassian.net/wiki/spaces/CVCGC/pages/825065479/Description+of+Chart#Descriptions-of-structure) 

## SetObjectPosition

This function sets the position of object to newx and newy values. The function returns True on success or False if an error occurs.

#### Syntax

```visualbasic
Function SetObjectPosition(newx As Long, newy As Long) As Boolean
```

## GetObjectPosition

This function returns the current position of object in parameters currentx and currenty.

#### Syntax

```visualbasic
Function GetObjectPosition(ByRef currentx As Long, currenty As Long)
```

## SetObjectDimensions

This function sets dimensions of object to newwidth and newheight values. The function returns True on success or False if an error occurs.

#### Syntax

```visualbasic
Function SetObjectDimensions(newwidth As Long, newheight As Long) As Boolean
```

## GetObjectDimensions

This function returns current size of object in parameters currentwidth and currentheight.

#### Syntax

```visualbasic
Function GetObjectDimensions(ByRef currentwidth As Long, ByRef currentheight As Long)
```

## ShowObject

This function shows object, property Visible is set to True.

#### Syntax

```visualbasic
Function ShowObject()
```

## HideObject

This function hides object, property Visible is set to False.

#### Syntax

```visualbasic
Function HideObject()
```

# Descriptions of structures

```visualbasic
Public Structure ChartDataStructure
	Var ItemValue [MAX_VALUE] 			As ChartValueStructure
	Var NumberOfItemValueItemsUsed		As Long	
	Var NumberOfXAxisValuesItemsUsed 	As Long	
	Var X_Axis							As X_AxisStructure
	Var Y_Axis							As Y_AxisStructure
	Var ScaleSize_Y_Axis				As Long
	Var ChartType						As Long	
	Var BackgroundColor					As Long
End Structure
```

|  |  |  |  |
| --- | --- | --- | --- |
| Var Name | Data Type | Allowed Values | Description |
| ItemValue | ChartValueStructure |  | Item data values, maximum number of items is 10 |
| NumberOfItemValueItemsUsed | Long | 0 - 10 | Number of items used ItemValue |
| NumberOfXAxisValuesItemsUsed | Long | 0 - 1200 | Number of items used in the X_axis |
| X_Axis | X_AxisStructure |  | X_Axis |
| Y_Axis | Y_AxisStructure |  | Y_Axis |
| ScaleSize_Y_Axis | Long | - maximum possible size := -1
- Any positive | Y_axis major axis scale size |
| ChartType | Long | CHART_TYPE_BAR := 1  
CHART_TYPE_LINE := 2  
CHART_TYPE_LINE_AREA := 3 | Type of chart |
| BackgroundColor | Long | Any | Color of background |

```visualbasic
Public Structure ChartValueStructure
	Var ChartValue [MAX_CHART_VALUE] As Double
	Var ColorValue					 As Long	
	Var ValuesDescription			 As Text[256]
End Structure
```

|  |  |  |  |
| --- | --- | --- | --- |
| Var Name | Data Type | Allowed Values | Description |
| ChartValue | Double | Any | Chart data values, maximum number of items is 1200 |
| ColorValue | Long | Any | Color of Chart item |
| ValuesDescription | Text | Any | Text of value description |

```visualbasic
Public Structure X_AxisStructure
	Var AxisValue [MAX_CHART_VALUE] As Text[25]			
	Var Color_MainAxis				As Long
	Var Color_MinorAxis				As Long
	Var Font 						As AddressOf _Font
	Var FontColor					As Long
End Structure
```

|  |  |  |  |
| --- | --- | --- | --- |
| Var Name | Data Type | Allowed Values | Description |
| AxisValue | Text | Any | X_Axis values, maximum number of items is 1200 |
| Color_MainAxis | Long | Any | Main Color of X_Axis |
| Color_MinorAxis | Long | Any | Minor Color of X_Axis |
| Font | AddressOf _Font | Any | Font of X_Axis |
| FontColor | Long | Any | Font color of X_Axis |

```visualbasic
Public Structure Y_AxisStructure
	Var Left_YAxis				As LeftAxisStructure	
	Var Right_YAxis				As RightAxisStructure
	Var Color_MainAxis			As Long
	Var Color_MinorAxis			As Long
	Var Font 					As AddressOf _Font
	Var FontColor				As Long
End Structure
```

|  |  |  |  |
| --- | --- | --- | --- |
| Var Name | Data Type | Allowed Values | Description |
| Left_YAxis | LeftAxisStructure |  | Main Y_Axis |
| Right_YAxis | RightAxisStructure |  | Minor Y_Axis |
| Color_MainAxis | Long | Any | Main Color of Y_Axis |
| Color_MinorAxis | Long | Any | Minor Color of Y_Axis |
| Font | AddressOf _Font | Any | Font of Y_Axis |
| FontColor | Long | Any | Font color of Y_Axis |

```visualbasic
Public Structure LeftAxisStructure
	Var Minimum 					As Double
	Var Maximum 					As Double
	Var MainValue					As Double
	Var ValueStep 					As Double
	Var DescriptionFormat_YAxis 	As Text[25]
End Structure
```

|  |  |  |  |
| --- | --- | --- | --- |
| Var Name | Data Type | Allowed Values | Description |
| Minimum | Double | Any | Minimum value of Major Y_Axis |
| Maximum | Double | Any | Maximum value of Major Y_Axis |
| MainValue | Double | Value between minimum and maximum | Position Main X_Axis |
| ValueStep | Double | Any | Step size of Major Y_Axis |
| DescriptionFormat_YAxis | Text | Any | Major Y_axis description format.   
Example: "{n.0} %" |

```visualbasic
Public Structure RightAxisStructure
	Var AxisValue [MAX_CHART_VALUE] As Double
	Var NumberOfItemsUsed 			As Long
	Var DescriptionFormat_YAxis		As Text[25]	
End Structure
```

|  |  |  |  |
| --- | --- | --- | --- |
| Var Name | Data Type | Allowed Values | Description |
| AxisValue | Double | Any | Minor Y_Axis values, maximum number of items is 1200 |
| NumberOfItemsUsed | Long | 0 - 1200 | Number of items used AxisValue |
| DescriptionFormat_YAxis | Text | Any | Minor Y_axis description format.   
Example: "{n.0} abc" |

> 📝 CHART_TYPE_BAR 		 	:= 1  
> 📝 CHART_TYPE_LINE 		 	:= 2  
> 📝 CHART_TYPE_LINE_AREA 	:= 3
> 📝 
> 📝 MAX_VALUE				:= 10  
> 📝 MAX_CHART_VALUE		:= 1200

# Example

```visualbasic
Public Var STR2 As Namespace "CUE.GraphicCollection.Chart.1".ChartDataStructure

Private Process Autoexec()
	Page1.ShowObject()
	SetData2()
	Page1.Chart1.SetChartData(STR2)
	Page1.Legend1.SetLegendData(STR2)
End Process

Public Function SetData2()
	Var i As Long
	STR2.ScaleSize_Y_Axis := -1
	STR2.ChartType := Namespace "CUE.GraphicCollection.Chart.1".CHART_TYPE_LINE_AREA
	
	STR2.X_Axis.AxisValue[1] := "January"
	STR2.X_Axis.AxisValue[2] := "February"
	STR2.X_Axis.AxisValue[3] := "March"
	STR2.X_Axis.AxisValue[4] := "April"
	STR2.X_Axis.AxisValue[5] := "May"
	STR2.X_Axis.AxisValue[6] := "June"
	STR2.X_Axis.AxisValue[7] := "July"
	STR2.X_Axis.AxisValue[8] := "August"
	STR2.X_Axis.AxisValue[9] := "September"
	STR2.X_Axis.AxisValue[10] := "October"
	STR2.X_Axis.AxisValue[11] := "November"
	STR2.X_Axis.AxisValue[12] := "December"	

	STR2.X_Axis.Color_MainAxis := _COLOR_MAGENTA
	STR2.X_Axis.Color_MinorAxis := SetColorComponentOpacity(STR2.X_Axis.Color_MainAxis,102)
	// Please replace font name MyCommon.fntArial with the name of a font that exists in your project
	STR2.X_Axis.Font := MyCommon.fntArial
	STR2.X_Axis.FontColor := _COLOR_BLACK
	STR2.BackgroundColor := _COLOR_WHITE

	STR2.Y_Axis.Left_YAxis.Minimum := -20
	STR2.Y_Axis.Left_YAxis.Maximum := 100
	STR2.Y_Axis.Left_YAxis.ValueStep := 10
	STR2.Y_Axis.Left_YAxis.MainValue := 0
	
	STR2.Y_Axis.Left_YAxis.DescriptionFormat_YAxis := "{n.0} %"
	STR2.Y_Axis.Color_MainAxis := _COLOR_BLACK
	STR2.Y_Axis.Color_MinorAxis := SetColorComponentOpacity(STR2.Y_Axis.Color_MainAxis,102)
	// Please replace font name MyCommon.fntArial with the name of a font that exists in your project
	STR2.Y_Axis.Font := MyCommon.fntArial
	STR2.Y_Axis.FontColor := _COLOR_BLACK
	
	For i := 1 To 6
		STR2.Y_Axis.Right_YAxis.AxisValue[i] := (i-1)*10
	End For		
	STR2.Y_Axis.Right_YAxis.DescriptionFormat_YAxis := "{n.0} abc"
	STR2.Y_Axis.Right_YAxis.NumberOfItemsUsed := 6
	
	STR2.ItemValue[1].ChartValue[1] := 25
	STR2.ItemValue[1].ChartValue[2] := 35
	STR2.ItemValue[1].ChartValue[3] := 45
	STR2.ItemValue[1].ChartValue[4] := 75
	STR2.ItemValue[1].ChartValue[5] := 95
	STR2.ItemValue[1].ChartValue[6] := 15
	STR2.ItemValue[1].ChartValue[7] := 8
	STR2.ItemValue[1].ChartValue[8] := 15
	STR2.ItemValue[1].ChartValue[9] := -10
	STR2.ItemValue[1].ChartValue[10] := 67
	STR2.ItemValue[1].ChartValue[11] := -8
	STR2.ItemValue[1].ChartValue[12] := 28	
	STR2.ItemValue[1].ColorValue := _COLOR_RED
	STR2.ItemValue[1].ValuesDescription := "apple"
	
	STR2.ItemValue[2].ChartValue[1] := 5
	STR2.ItemValue[2].ChartValue[2] := 15
	STR2.ItemValue[2].ChartValue[3] := 25
	STR2.ItemValue[2].ChartValue[4] := 73
	STR2.ItemValue[2].ChartValue[5] := 85
	STR2.ItemValue[2].ChartValue[6] := 5
	STR2.ItemValue[2].ChartValue[7] := 18
	STR2.ItemValue[2].ChartValue[8] := 15
	STR2.ItemValue[2].ChartValue[9] := -5
	STR2.ItemValue[2].ChartValue[10] := 68
	STR2.ItemValue[2].ChartValue[11] := 32
	STR2.ItemValue[2].ChartValue[12] := 38
	STR2.ItemValue[2].ColorValue := _COLOR_YELLOW
	STR2.ItemValue[2].ValuesDescription := "pear"
	
	STR2.ItemValue[3].ChartValue[1] := 20
	STR2.ItemValue[3].ChartValue[2] := 30
	STR2.ItemValue[3].ChartValue[3] := 40
	STR2.ItemValue[3].ChartValue[4] := 60
	STR2.ItemValue[3].ChartValue[5] := 90
	STR2.ItemValue[3].ChartValue[6] := 10
	STR2.ItemValue[3].ChartValue[7] := 100
	STR2.ItemValue[3].ChartValue[8] := 70
	STR2.ItemValue[3].ChartValue[9] := 110
	STR2.ItemValue[3].ChartValue[10] := 0
	STR2.ItemValue[3].ChartValue[11] := 50
	STR2.ItemValue[3].ChartValue[12] := 80
	STR2.ItemValue[3].ColorValue := _COLOR_BLUE
	STR2.ItemValue[3].ValuesDescription := "blueberry"
	
	STR2.NumberOfItemValueItemsUsed := 3	
	STR2.NumberOfXAxisValuesItemsUsed := 12	
End Function
```

![image](media://72a2a657-1a97-4682-a66a-f098a2154252)