06-20-2011, 01:08 PM,
(This post was last modified: 06-23-2011, 04:19 PM by ashimo.)
|
|||||
|
|||||
Page 6: Structure of a Program that Specifies the Graph Colors
Structure of the program that specifies the graph colors
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. Array-of 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 int and char, as well as class types such as String. In Curl, we can create an array by coding the following. Creating an Array Code: {{Array-of element_type} element_1, element_2, element_3, …} For example, we would code a character string array with three elements as follows: Code: {{Array-of String} “ character string 1”, “character string 2”, “character string 3”} To declare array variables, we code the following: Code: let array_variable_name:{Array-of element type} = For example, the following declaration specifies a variable called “array” which is bound to an array having three character string elements: Code: let array:{Array-of String} = 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]. 1. Array variable declaration Code: let color-array:{Array-of FillPattern} = Graph colors are specified with a FillPattern array. FillPattern is used to specify how an object is colored. Monochrome shades can also be specified using a string. 2. Specifying the graph color Code: color-palette = color-array, We can use the color-palette option of LayeredChart to specify the color of a graph. Here, we specify the array that we created in (1). |
|||||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Page 6: Structure of a Program that Specifies the Graph Colors - by ashimo - 06-20-2011, 01:08 PM
|
Possibly Related Threads... | |||||
Thread | Author | Replies | Views | Last Post | |
Page 5: Application 2: Specifying the Graph Colors | ashimo | 1 | 5,739 |
11-19-2016, 01:59 PM Last Post: milijacob |
|
Page 8: Extra Practice | ashimo | 0 | 3,624 |
06-20-2011, 01:10 PM Last Post: ashimo |
|
Page 7: Summary | ashimo | 0 | 3,282 |
06-20-2011, 01:09 PM Last Post: ashimo |
|
Page 4: Structure of a Program that Specifies the Graph Axes | ashimo | 0 | 3,496 |
06-20-2011, 01:06 PM Last Post: ashimo |
|
Page 3: Application 1: Specifying the Graph Axes | ashimo | 0 | 3,417 |
06-20-2011, 01:05 PM Last Post: ashimo |
|
Page 2: Structure of a Program that Displays Data as a Graph | ashimo | 0 | 3,413 |
06-20-2011, 01:03 PM Last Post: ashimo |
|
Page 1: Displaying Data as a Graph | ashimo | 0 | 3,160 |
06-20-2011, 11:59 AM Last Post: ashimo |
Users browsing this thread:
1 Guest(s)
1 Guest(s)