!../../wiki/easy-ide-book/common/images/prev_page.gif! !../../wiki/easy-ide-book/common/images/toc.gif! !../../wiki/easy-ide-book/common/images/next_page.gif!
<font color="navy">Structure of the program that specifies the graph colors</font> 
Graph colors are specified with an array. First, therefore, we should explain an array.
An array consists of a group of elements that are arranged into an order. Each element has a corresponding index, beginning from 0. <font color="purple">Array-of</font> is one kind of array; the data type of the elements in the array is specified when the array is declared. As the data type, we can specify primitive types such as <font color="purple">int</font> and <font color="purple">char</font>, as well as class types such as <font color="purple">String</font>.
In Curl, we can create an array by coding the following.
-
<font color="#006968">Creating an Array</font>
{{Array-of element_type} element_1, element_2, element_3,
}
</font>
-
For example, we would code a character string array with three elements as follows:
{{Array-of String} character string 1, character string 2, character string 3}
To declare array variables, we code the following:
let array_variable_name:{Array-of element type} =
{{Array-of data type} element_1, element_2, element_3,
}
For example, the following declaration specifies a variable called array which is bound to an array having three character string elements:
let array:{Array-of String} =
{{Array-of String} character string 1, character string 2, character string 3}
When we create an array in Curl, we specify the element type. There is no need to specify the size of the array in advance. The number of elements can change later.
Also, using array_name\[index\] syntax, we can access elements from the array. For example, to access character string 2 whose index is 1, we specify array\[1\].
let color-array:{Array-of FillPattern} =
{{Array-of FillPattern} orange, pink}
Graph colors are specified with a <font color="purple">FillPattern</font> array. <font color="purple">FillPattern</font> is used to specify how an object is colored. Monochrome shades can also be specified using a string.
color-palette = color-array,
We can use the color-palette option of <font color="purple">LayeredChart</font> to specify the color of a graph. Here, we specify the array that we created in (1).
There are no comments on this document