!../../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">Application 2: Specifying the graph colors</font> 
The graphs that we have looked at so far have all used preset colors. We can, however, use options to change the graph color.
<font color="black">Create the 'Try 4-3' Project</font>
Close the Try 4-2 project and then, from the IDE 'File' menu, select 'New Project'. In the 'New Project' dialog box, select Applet Project (1), input Try4-3 (2), specify c:\Curl\lesson\Try4\03_graph_color in the Directory field (3), set the API Version to 6.0 (4), and then click OK (5).
<font color="black">Inputting the Program</font>
Next, well input the program. You can copy the program code below or use c:\Curl\Try4\03_graph_color\start.curl and then paste it into the editor in the IDE.
{curl 6.0 applet}
{curl-file-attributes character-encoding = utf8}
{applet manifest = manifest.mcurl,
{compiler-directives careful? = true}
}
{import * from CURL.GUI.CHARTS}
{value
let data:RecordSet =
{RecordSet
{RecordFields
{RecordField name, domain = String},
{RecordField age, domain = int},
{RecordField score, domain = int}
},
{RecordData name = Matt, age = 33, score = 88},
{RecordData name = Sarah, age = 27, score = 79},
{RecordData name = Jacob, age = 26, score = 90}
}
let color-array:{Array-of FillPattern} =
{{Array-of FillPattern} orange, pink}
let chart:LayeredChart =
{LayeredChart
height = 5cm,
width = 10cm,
color-palette = color-array,
{BarLayer
x-axis-data = {ChartDataSeries data, name},
{ChartDataSeries data, age},
{ChartDataSeries data, score}
}
}
chart
}
<font color="black">Save the File, and then Execute the Program</font>
After inputting the code, save the file, and then execute the program. The following result will appear in your browser.
The samples that we have looked at so far have all used preset colors for the graphs. Here, we have set whatever color we like for our graph display.
There are no comments on this document