<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Curl Global Community - Try 4: Displaying Data as a Graph]]></title>
		<link>https://communities.curl.com/</link>
		<description><![CDATA[Curl Global Community - https://communities.curl.com]]></description>
		<pubDate>Fri, 24 Apr 2026 17:24:12 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Page 8: Extra Practice]]></title>
			<link>https://communities.curl.com/showthread.php?tid=70</link>
			<pubDate>Mon, 20 Jun 2011 04:10:44 +0000</pubDate>
			<guid isPermaLink="false">https://communities.curl.com/showthread.php?tid=70</guid>
			<description><![CDATA[<span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Extra Practice</span></span></span><br />
<br />
Let’s use options to change the format and colors of a graph.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Practice Problem 1: Basics</span></span></span><br />
<br />
Define data like that shown below, and then display a cumulative bar graph for the score1 and score2 data fields. For the x-axis label, use the <span style="font-family: Courier;" class="mycode_font">name</span> field.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let data:RecordSet = {RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField score1, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField score2, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Matt, score1 = 30, score2 = 45},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Sarah, score1 = 55, score2 = 40},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Jacob, score1 = 20, score2 = 65}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</code></div></div><br />
<img src="wiki/easy-ide-book/try4/images/figure_4_16.png" /><br />
<br />
Hint: To display the cumulative graph, use stacking-mode = ChartStackingMode.stacked with <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">BarLayer</span></span>.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Solution</span></span></span><br />
<br />
Solution Program: <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\04_exercise1\start.curl</span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score1, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score2, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, score1 = 30, score2 = 45},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, score1 = 55, score2 = 40},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, score1 = 20, score2 = 65}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart = {LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height = 5cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width = 10cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs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DataSeries data, score2}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
}</code></div></div><br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Practice Problem 2: Basics</span></span></span><br />
<br />
Display the data used with Practice Problem 1 as a bar graph. In this problem, reverse the directions of the x- and y-axes and then display the graph.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_17.png" /><br />
<br />
Hint: To change the orientation of the graph, use flipped? = true with <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span>.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Solution</span></span></span><br />
<br />
Solution Program: <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\05_exercise2\start.curl</span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score1, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score2, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, score1 = 30, score2 = 45},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, score1 = 55, score2 = 40},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, score1 = 20, score2 = 65}`<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart = {LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {ChartDataSeries data, score1},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {ChartDataSeries data, score2}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
}</code></div></div><br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Practice Problem 3: Basics</span></span></span><br />
<br />
Using the same data as that used in Practice Problem 1, display the score1 data as a bar graph, and the score2 data as a line graph, as shown in the figure below:<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_18.png" /><br />
<br />
Hint: <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span> can have multiple <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartLayer</span></span>s.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Solution</span></span></span><br />
<br />
Solution Program: <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\06_exercise3\start.curl</span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score1, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score2, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, score1 = 30, score2 = 45},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, score1 = 55, score2 = 40},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, score1 = 20, score2 = 65}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart = {LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height = 5cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width = 10cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {BarLayer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[<span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Extra Practice</span></span></span><br />
<br />
Let’s use options to change the format and colors of a graph.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Practice Problem 1: Basics</span></span></span><br />
<br />
Define data like that shown below, and then display a cumulative bar graph for the score1 and score2 data fields. For the x-axis label, use the <span style="font-family: Courier;" class="mycode_font">name</span> field.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let data:RecordSet = {RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField score1, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField score2, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Matt, score1 = 30, score2 = 45},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Sarah, score1 = 55, score2 = 40},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Jacob, score1 = 20, score2 = 65}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</code></div></div><br />
<img src="wiki/easy-ide-book/try4/images/figure_4_16.png" /><br />
<br />
Hint: To display the cumulative graph, use stacking-mode = ChartStackingMode.stacked with <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">BarLayer</span></span>.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Solution</span></span></span><br />
<br />
Solution Program: <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\04_exercise1\start.curl</span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score1, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score2, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, score1 = 30, score2 = 45},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, score1 = 55, score2 = 40},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, score1 = 20, score2 = 65}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart = {LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height = 5cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width = 10cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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artDataSeries data, score2}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
}</code></div></div><br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Practice Problem 2: Basics</span></span></span><br />
<br />
Display the data used with Practice Problem 1 as a bar graph. In this problem, reverse the directions of the x- and y-axes and then display the graph.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_17.png" /><br />
<br />
Hint: To change the orientation of the graph, use flipped? = true with <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span>.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Solution</span></span></span><br />
<br />
Solution Program: <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\05_exercise2\start.curl</span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score1, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score2, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, score1 = 30, score2 = 45},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, score1 = 55, score2 = 40},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, score1 = 20, score2 = 65}`<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart = {LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {ChartDataSeries data, score1},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {ChartDataSeries data, score2}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
}</code></div></div><br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Practice Problem 3: Basics</span></span></span><br />
<br />
Using the same data as that used in Practice Problem 1, display the score1 data as a bar graph, and the score2 data as a line graph, as shown in the figure below:<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_18.png" /><br />
<br />
Hint: <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span> can have multiple <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartLayer</span></span>s.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Solution</span></span></span><br />
<br />
Solution Program: <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\06_exercise3\start.curl</span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score1, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score2, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, score1 = 30, score2 = 45},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, score1 = 55, score2 = 40},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, score1 = 20, score2 = 65}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart = {LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height = 5cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width = 10cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {BarLayer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Page 7: Summary]]></title>
			<link>https://communities.curl.com/showthread.php?tid=69</link>
			<pubDate>Mon, 20 Jun 2011 04:09:40 +0000</pubDate>
			<guid isPermaLink="false">https://communities.curl.com/showthread.php?tid=69</guid>
			<description><![CDATA[<span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">TRY 4 Summary</span></span></span><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Two types of graphs: LayeredChart &amp; PieChart</span></span></span><br />
<br />
<hr class="mycode_hr" />
<br />
<img src="wiki/easy-ide-book/common/images/syntax.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">LayeredChart</span></span></span><br />
<br />
Used to create a graph on which data is plotted in two dimensions, with an x- and y-axis<br />
<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;{ Specification of each layer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x-axis-data =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data RecordSet, RecordField used for X-axis label}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data RecordSet, RecordField that is plotted}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;Specify ChartDataSeries only for the RecordField value to be graphed<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
<hr class="mycode_hr" />
<br />
<img src="wiki/easy-ide-book/common/images/syntax.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">PieChart</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{PieChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;{PieSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;label-data =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data RecordSet, RecordField used as label},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data RecordSet, RecordField that is plotted}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;Specify ChartDataSeries only for the RecordField value to be graphed<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
<hr class="mycode_hr" />
<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">The graph axes can be set flexibly using top-axis, bottom-axis, left-axis, and right-axis.</span><br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Any changes to the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> data are automatically reflected on the graph.</span><br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Declaring Curl array variables</span><br />
</li>
</ul>
<br />
<img src="wiki/easy-ide-book/common/images/syntax.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Declaring array variables</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let array-variable-name:{Array-of element-type-name} =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{Array-of element-type-name} element 1, element 2, …}</code></div></div>]]></description>
			<content:encoded><![CDATA[<span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">TRY 4 Summary</span></span></span><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Two types of graphs: LayeredChart &amp; PieChart</span></span></span><br />
<br />
<hr class="mycode_hr" />
<br />
<img src="wiki/easy-ide-book/common/images/syntax.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">LayeredChart</span></span></span><br />
<br />
Used to create a graph on which data is plotted in two dimensions, with an x- and y-axis<br />
<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;{ Specification of each layer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x-axis-data =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data RecordSet, RecordField used for X-axis label}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data RecordSet, RecordField that is plotted}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;Specify ChartDataSeries only for the RecordField value to be graphed<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
<hr class="mycode_hr" />
<br />
<img src="wiki/easy-ide-book/common/images/syntax.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">PieChart</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{PieChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;{PieSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;label-data =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data RecordSet, RecordField used as label},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data RecordSet, RecordField that is plotted}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;Specify ChartDataSeries only for the RecordField value to be graphed<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
<hr class="mycode_hr" />
<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">The graph axes can be set flexibly using top-axis, bottom-axis, left-axis, and right-axis.</span><br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Any changes to the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> data are automatically reflected on the graph.</span><br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Declaring Curl array variables</span><br />
</li>
</ul>
<br />
<img src="wiki/easy-ide-book/common/images/syntax.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Declaring array variables</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let array-variable-name:{Array-of element-type-name} =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{Array-of element-type-name} element 1, element 2, …}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Page 6: Structure of a Program that Specifies the Graph Colors]]></title>
			<link>https://communities.curl.com/showthread.php?tid=68</link>
			<pubDate>Mon, 20 Jun 2011 04:08:16 +0000</pubDate>
			<guid isPermaLink="false">https://communities.curl.com/showthread.php?tid=68</guid>
			<description><![CDATA[<img src="wiki/easy-ide-book/common/images/topic.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Structure of the program that specifies the graph colors</span></span></span><img src="wiki/easy-ide-book/common/images/topic.gif" /><br />
<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_13.png" /><br />
<br />
Graph colors are specified with an array. First, therefore, we should explain an array.<br />
<br />
An array consists of a group of elements that are arranged into an order. Each element has a corresponding index, beginning from 0. <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">Array-of</span></span> 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 <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">int</span></span> and <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">char</span></span>, as well as class types such as <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">String</span></span>.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_14.png" /><br />
<br />
In Curl, we can create an array by coding the following.<br />
<br />
<hr class="mycode_hr" />
<br />
<img src="wiki/easy-ide-book/common/images/syntax.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Creating an Array</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{{Array-of element_type} element_1, element_2, element_3, …}</code></div></div><br />
<hr class="mycode_hr" />
<br />
For example, we would code a character string array with three elements as follows:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{{Array-of String} “ character string 1”, “character string 2”, “character string 3”}</code></div></div><br />
To declare array variables, we code the following:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let array_variable_name:{Array-of element type} =<br />
&nbsp;&nbsp;&nbsp;&nbsp;{{Array-of data type} element_1, element_2, element_3, …}</code></div></div><br />
For example, the following declaration specifies a variable called “array” which is bound to an array having three character string elements:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let array:{Array-of String} =<br />
&nbsp;&nbsp;&nbsp;&nbsp;{{Array-of String} “ character string 1”, “character string 2”, “character string 3”}</code></div></div><br />
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.<br />
<br />
Also, using <span style="font-family: Courier;" class="mycode_font">array_name[index]</span> syntax, we can access elements from the array. For example, to access “character string 2” whose index is 1, we specify <span style="font-family: Courier;" class="mycode_font">array[1]</span>.<br />
<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_15.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">1. Array variable declaration</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let color-array:{Array-of FillPattern} =<br />
&nbsp;&nbsp;&nbsp;&nbsp;{{Array-of FillPattern} orange, pink}</code></div></div><br />
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.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">2. Specifying the graph color</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>color-palette = color-array,</code></div></div><br />
We can use the color-palette option of <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span> to specify the color of a graph. Here, we specify the array that we created in (1).]]></description>
			<content:encoded><![CDATA[<img src="wiki/easy-ide-book/common/images/topic.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Structure of the program that specifies the graph colors</span></span></span><img src="wiki/easy-ide-book/common/images/topic.gif" /><br />
<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_13.png" /><br />
<br />
Graph colors are specified with an array. First, therefore, we should explain an array.<br />
<br />
An array consists of a group of elements that are arranged into an order. Each element has a corresponding index, beginning from 0. <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">Array-of</span></span> 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 <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">int</span></span> and <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">char</span></span>, as well as class types such as <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">String</span></span>.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_14.png" /><br />
<br />
In Curl, we can create an array by coding the following.<br />
<br />
<hr class="mycode_hr" />
<br />
<img src="wiki/easy-ide-book/common/images/syntax.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Creating an Array</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{{Array-of element_type} element_1, element_2, element_3, …}</code></div></div><br />
<hr class="mycode_hr" />
<br />
For example, we would code a character string array with three elements as follows:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{{Array-of String} “ character string 1”, “character string 2”, “character string 3”}</code></div></div><br />
To declare array variables, we code the following:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let array_variable_name:{Array-of element type} =<br />
&nbsp;&nbsp;&nbsp;&nbsp;{{Array-of data type} element_1, element_2, element_3, …}</code></div></div><br />
For example, the following declaration specifies a variable called “array” which is bound to an array having three character string elements:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let array:{Array-of String} =<br />
&nbsp;&nbsp;&nbsp;&nbsp;{{Array-of String} “ character string 1”, “character string 2”, “character string 3”}</code></div></div><br />
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.<br />
<br />
Also, using <span style="font-family: Courier;" class="mycode_font">array_name[index]</span> syntax, we can access elements from the array. For example, to access “character string 2” whose index is 1, we specify <span style="font-family: Courier;" class="mycode_font">array[1]</span>.<br />
<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_15.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">1. Array variable declaration</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let color-array:{Array-of FillPattern} =<br />
&nbsp;&nbsp;&nbsp;&nbsp;{{Array-of FillPattern} orange, pink}</code></div></div><br />
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.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">2. Specifying the graph color</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>color-palette = color-array,</code></div></div><br />
We can use the color-palette option of <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span> to specify the color of a graph. Here, we specify the array that we created in (1).]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Page 5: Application 2: Specifying the Graph Colors]]></title>
			<link>https://communities.curl.com/showthread.php?tid=67</link>
			<pubDate>Mon, 20 Jun 2011 04:07:08 +0000</pubDate>
			<guid isPermaLink="false">https://communities.curl.com/showthread.php?tid=67</guid>
			<description><![CDATA[<img src="wiki/easy-ide-book/common/images/topic.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Application 2: Specifying the graph colors</span></span></span><img src="wiki/easy-ide-book/common/images/topic.gif" /><br />
<br />
The graphs that we have looked at so far have all used preset colors. We can, however, use options to change the graph color.<br />
<br />
<img src="wiki/easy-ide-book/common/images/step1.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Create the 'Try 4-3' Project</span></span></span><br />
<br />
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 <span style="font-family: Courier;" class="mycode_font">c:\Curl\lesson\Try4\03_graph_color</span> in the “Directory” field (3), set the API Version to 6.0 (4), and then click OK (5).<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_11.png" /><br />
<br />
<img src="wiki/easy-ide-book/common/images/step2.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Inputting the Program</span></span></span><br />
<br />
Next, we’ll input the program. You can copy the program code below or use <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\03_graph_color\start.curl</span> and then paste it into the editor in the IDE.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{curl 6.0 applet}<br />
{curl-file-attributes character-encoding = utf8}<br />
{applet manifest = manifest.mcurl,<br />
&nbsp;&nbsp;&nbsp;&nbsp;{compiler-directives careful? = true}<br />
}<br />
{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField age, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, age = 33, score = 88},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, age = 27, score = 79},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, age = 26, score = 90}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let color-array:{Array-of FillPattern} =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{Array-of FillPattern} orange, pink}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height = 5cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width = 10cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color-palette = color-array,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{BarLayer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x-axis-data = {ChartDataSeries data, name},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data, age},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data, score}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
}</code></div></div><br />
<img src="wiki/easy-ide-book/common/images/step3.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Save the File, and then Execute the Program</span></span></span><br />
<br />
After inputting the code, save the file, and then execute the program. The following result will appear in your browser.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_12.png" /><br />
<br />
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.]]></description>
			<content:encoded><![CDATA[<img src="wiki/easy-ide-book/common/images/topic.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Application 2: Specifying the graph colors</span></span></span><img src="wiki/easy-ide-book/common/images/topic.gif" /><br />
<br />
The graphs that we have looked at so far have all used preset colors. We can, however, use options to change the graph color.<br />
<br />
<img src="wiki/easy-ide-book/common/images/step1.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Create the 'Try 4-3' Project</span></span></span><br />
<br />
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 <span style="font-family: Courier;" class="mycode_font">c:\Curl\lesson\Try4\03_graph_color</span> in the “Directory” field (3), set the API Version to 6.0 (4), and then click OK (5).<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_11.png" /><br />
<br />
<img src="wiki/easy-ide-book/common/images/step2.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Inputting the Program</span></span></span><br />
<br />
Next, we’ll input the program. You can copy the program code below or use <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\03_graph_color\start.curl</span> and then paste it into the editor in the IDE.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{curl 6.0 applet}<br />
{curl-file-attributes character-encoding = utf8}<br />
{applet manifest = manifest.mcurl,<br />
&nbsp;&nbsp;&nbsp;&nbsp;{compiler-directives careful? = true}<br />
}<br />
{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField age, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, age = 33, score = 88},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, age = 27, score = 79},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, age = 26, score = 90}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let color-array:{Array-of FillPattern} =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{Array-of FillPattern} orange, pink}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height = 5cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width = 10cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color-palette = color-array,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{BarLayer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x-axis-data = {ChartDataSeries data, name},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data, age},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data, score}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
}</code></div></div><br />
<img src="wiki/easy-ide-book/common/images/step3.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Save the File, and then Execute the Program</span></span></span><br />
<br />
After inputting the code, save the file, and then execute the program. The following result will appear in your browser.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_12.png" /><br />
<br />
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.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Page 4: Structure of a Program that Specifies the Graph Axes]]></title>
			<link>https://communities.curl.com/showthread.php?tid=66</link>
			<pubDate>Mon, 20 Jun 2011 04:06:04 +0000</pubDate>
			<guid isPermaLink="false">https://communities.curl.com/showthread.php?tid=66</guid>
			<description><![CDATA[<span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Structure of program that specifies the graph axes</span></span></span><br />
<br />
Let’s specify the axes for the graph introduced in the “Basics” section.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_10.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">1. Specifying the positions of the axes</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>top-axis = {ChartAxis {ChartDataSeries data, name}},<br />
left-axis = {ChartAxis {ChartDataSeries data, age}},</code></div></div><br />
The <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span> class has four options, namely, top-axis, bottom-axis, right-axis, and left-axis. Using these, we can place the four sides of a graph wherever we wish. In our example here, we specify the top and left sides of the graph. The specification is made using <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartAxis</span></span>.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">2. Specifying the range of axis gradations</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>right-axis = {{NumericDataSeriesAxis-of float} <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; force-zero? = false, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {ChartDataSeries data, score}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</code></div></div><br />
Using right-axis we specify the right axis. In (1), we used <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartAxis</span></span>, but in this example we’ll use <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">NumericDataSeriesAxis-of</span></span>. <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">NumericDataSeriesAxis-of</span></span> lets us set the range of the axis gradations, by specifying a minimum and maximum value. Here, by setting force-zero? to false, 0 is not displayed and the axis range is automatically set to cover an appropriate range.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">3. Creating a line graph</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{LineLayer<br />
&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data, score},<br />
&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data, age}<br />
}</code></div></div><br />
Here, rather than create a bar graph, we will plot a line graph. To do this, we use <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LineLayer</span></span>. Because the axes are specified with the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span>, there is no need for the x-axis-data specification.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">4. Displaying the layout</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{VBox<br />
&nbsp;&nbsp;&nbsp;&nbsp; {RecordGrid<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; record-source = data,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height = 3cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width = 10cm<br />
&nbsp;&nbsp;&nbsp;&nbsp; },<br />
&nbsp;&nbsp;&nbsp;&nbsp; chart<br />
 }</code></div></div><br />
The final expression in the value block specifies the layout. Here, we use a <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordGrid</span></span> to also display the data in the same <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span>. When <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordGrid</span></span> is used to modify the data, the graph values will also be modified in real time because any changes to <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> values that are used as data are automatically reflected on the graph.]]></description>
			<content:encoded><![CDATA[<span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Structure of program that specifies the graph axes</span></span></span><br />
<br />
Let’s specify the axes for the graph introduced in the “Basics” section.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_10.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">1. Specifying the positions of the axes</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>top-axis = {ChartAxis {ChartDataSeries data, name}},<br />
left-axis = {ChartAxis {ChartDataSeries data, age}},</code></div></div><br />
The <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span> class has four options, namely, top-axis, bottom-axis, right-axis, and left-axis. Using these, we can place the four sides of a graph wherever we wish. In our example here, we specify the top and left sides of the graph. The specification is made using <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartAxis</span></span>.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">2. Specifying the range of axis gradations</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>right-axis = {{NumericDataSeriesAxis-of float} <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; force-zero? = false, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {ChartDataSeries data, score}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</code></div></div><br />
Using right-axis we specify the right axis. In (1), we used <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartAxis</span></span>, but in this example we’ll use <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">NumericDataSeriesAxis-of</span></span>. <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">NumericDataSeriesAxis-of</span></span> lets us set the range of the axis gradations, by specifying a minimum and maximum value. Here, by setting force-zero? to false, 0 is not displayed and the axis range is automatically set to cover an appropriate range.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">3. Creating a line graph</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{LineLayer<br />
&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data, score},<br />
&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data, age}<br />
}</code></div></div><br />
Here, rather than create a bar graph, we will plot a line graph. To do this, we use <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LineLayer</span></span>. Because the axes are specified with the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span>, there is no need for the x-axis-data specification.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">4. Displaying the layout</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{VBox<br />
&nbsp;&nbsp;&nbsp;&nbsp; {RecordGrid<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; record-source = data,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height = 3cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width = 10cm<br />
&nbsp;&nbsp;&nbsp;&nbsp; },<br />
&nbsp;&nbsp;&nbsp;&nbsp; chart<br />
 }</code></div></div><br />
The final expression in the value block specifies the layout. Here, we use a <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordGrid</span></span> to also display the data in the same <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span>. When <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordGrid</span></span> is used to modify the data, the graph values will also be modified in real time because any changes to <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> values that are used as data are automatically reflected on the graph.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Page 3: Application 1: Specifying the Graph Axes]]></title>
			<link>https://communities.curl.com/showthread.php?tid=65</link>
			<pubDate>Mon, 20 Jun 2011 04:05:02 +0000</pubDate>
			<guid isPermaLink="false">https://communities.curl.com/showthread.php?tid=65</guid>
			<description><![CDATA[<img src="wiki/easy-ide-book/common/images/topic.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Application 1: Specifying the graph axes</span></span></span><img src="wiki/easy-ide-book/common/images/topic.gif" /><br />
<br />
Next, we’ll specify the gradations and positions of the graph axes.<br />
<br />
<img src="wiki/easy-ide-book/common/images/step1.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Create the 'Try 4-2' Project</span></span></span><br />
<br />
Close the Try 4 project and then, from the IDE 'File' menu, select 'New Project'. In the 'New Project' dialog box, select “Applet Project” (1), input “Try4-2” (2), specify <span style="font-family: Courier;" class="mycode_font">c:\Curl\lesson\Try4\02_set_axis</span> in the “Directory” field (3), set the <span style="font-family: Courier;" class="mycode_font">API Version</span> to <span style="font-family: Courier;" class="mycode_font">6.0</span> (4), and then click OK (5).<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_8.png" /><br />
<br />
<img src="wiki/easy-ide-book/common/images/step2.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Inputting the Program</span></span></span><br />
<br />
Next, we’ll input the program. You can copy the program code below or use <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\02_set_axis\start.curl</span> and then paste it into the editor in the IDE.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet = {RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField age, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField score, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Matt, age = 33, score = 88},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Sarah, age = 27, score = 79},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Jacob, age = 26, score = 90}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart = {LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height = 5cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width = 10cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top-axis = {ChartAxis {ChartDataSeries data, name}},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; left-axis = {ChartAxis {ChartDataSeries data, age}},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; right-axis = {{NumericDataSeriesAxis-of float} <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height = 3cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width = 10cm<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
<img src="wiki/easy-ide-book/common/images/step3.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Save the File, and then Execute the Program</span></span></span><br />
<br />
After inputting the code, save the file, and then execute the program. The following result will appear in your browser.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_9.png" />]]></description>
			<content:encoded><![CDATA[<img src="wiki/easy-ide-book/common/images/topic.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Application 1: Specifying the graph axes</span></span></span><img src="wiki/easy-ide-book/common/images/topic.gif" /><br />
<br />
Next, we’ll specify the gradations and positions of the graph axes.<br />
<br />
<img src="wiki/easy-ide-book/common/images/step1.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Create the 'Try 4-2' Project</span></span></span><br />
<br />
Close the Try 4 project and then, from the IDE 'File' menu, select 'New Project'. In the 'New Project' dialog box, select “Applet Project” (1), input “Try4-2” (2), specify <span style="font-family: Courier;" class="mycode_font">c:\Curl\lesson\Try4\02_set_axis</span> in the “Directory” field (3), set the <span style="font-family: Courier;" class="mycode_font">API Version</span> to <span style="font-family: Courier;" class="mycode_font">6.0</span> (4), and then click OK (5).<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_8.png" /><br />
<br />
<img src="wiki/easy-ide-book/common/images/step2.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Inputting the Program</span></span></span><br />
<br />
Next, we’ll input the program. You can copy the program code below or use <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\02_set_axis\start.curl</span> and then paste it into the editor in the IDE.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet = {RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField age, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordField score, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Matt, age = 33, score = 88},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Sarah, age = 27, score = 79},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {RecordData name = Jacob, age = 26, score = 90}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart = {LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height = 5cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width = 10cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top-axis = {ChartAxis {ChartDataSeries data, name}},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; left-axis = {ChartAxis {ChartDataSeries data, age}},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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p;&nbsp;&nbsp;{VBox<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordGrid<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;record-source = data,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height = 3cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width = 10cm<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
<img src="wiki/easy-ide-book/common/images/step3.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Save the File, and then Execute the Program</span></span></span><br />
<br />
After inputting the code, save the file, and then execute the program. The following result will appear in your browser.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_9.png" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Page 2: Structure of a Program that Displays Data as a Graph]]></title>
			<link>https://communities.curl.com/showthread.php?tid=64</link>
			<pubDate>Mon, 20 Jun 2011 04:03:47 +0000</pubDate>
			<guid isPermaLink="false">https://communities.curl.com/showthread.php?tid=64</guid>
			<description><![CDATA[<img src="wiki/easy-ide-book/common/images/topic.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Structure of the Program that Displays Data as a Graph</span></span></span><img src="wiki/easy-ide-book/common/images/topic.gif" /><br />
<br />
In Try 3, we displayed the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> data as a grid. In this chapter, we will concentrate on displaying <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> data using different types of charts.<br />
<br />
So, let’s start by taking a look at the program’s source code.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_3.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">1. Importing the 'CURL.GUI.CHARTS' package</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}</code></div></div><br />
The API needed to create a graph can be found the <span style="font-family: Courier;" class="mycode_font">CURL.GUI.CHARTS</span> package. By using an import statement to import this package, we can then use the necessary functions provided by the package.<br />
<br />
<hr class="mycode_hr" />
<br />
<img src="wiki/easy-ide-book/common/images/hint.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Packages</span></span></span><br />
<br />
A package contains logically grouped code. We can import packages and use the definitions in those packages.<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">2. Converting data to a graph</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField age, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, age = 33, score = 88},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, age = 27, score = 79},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, age = 26, score = 90}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</code></div></div><br />
To create a graph, we use the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> data. We’ll plot a graph for each <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordField</span></span> value in the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span>.<br />
<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_4.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">3. Creating a 'LayeredChart'</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let chart:LayeredChart =<br />
&nbsp;&nbsp;&nbsp;&nbsp;{LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</code></div></div><br />
In the same way as for a bar or line graph, a <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span> requires that, prior to plotting any data, we define a 2-dimensional area with an x- and y-axis. We will next add the layer to our <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span> and then plot our graph.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">4. Specifying a Layer</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{BarLayer<br />
&nbsp;&nbsp;&nbsp;&nbsp;...<br />
}</code></div></div><br />
We specify a layer to define the data to be plotted, as well as the plotting method (bar graph, line graph, etc.). In this example, in which we create a bar graph, we specify a <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">BarLayer</span></span>. Figure 4-5 shows the available layer types.<br />
<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_5.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">5. Specifying a label for the X-axis</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>x-axis-data = {ChartDataSeries data, name}</code></div></div><br />
The x-axis-data keyword argument controls the labeling of the x-axis. Using this argument, we can specify the field values used as captions on the -x-axis If we omit this argument, then an index starting from 0 is displayed on the x-axis. This x-axis information is specified using <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartDataSeries</span></span>.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_6.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">6. Specifying graph data</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{ChartDataSeries data, score}</code></div></div><br />
We also use <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartDataSeries</span></span> to specify the data to be plotted on a graph. We specify the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> containing the data, as well as the names of the fields we want to display on the graph. Although we can specify multiple <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartDataSeries</span></span>, in this example, we specify only one.<br />
<br />
<hr class="mycode_hr" />
<br />
<img src="wiki/easy-ide-book/common/images/hint.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">LayeredChart and PieChart</span></span></span><br />
<br />
Curl supports two main types of graphs. The first type plots data in two dimensions, using x- and y-axes, like the bar graph in the example in Try 4-1. This type of graph is created using LayeredChart. The second type is the pie graph. To create a pie graph, we use <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">PieChart</span></span>. For a pie graph, rather than specify each layer, we use <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">PieSet</span></span> to specify the data to be plotted. By specifying multiple instances of PieSet, we can create a graph consisting of concentric circles. And, by using label-data, we can also display labels.]]></description>
			<content:encoded><![CDATA[<img src="wiki/easy-ide-book/common/images/topic.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Structure of the Program that Displays Data as a Graph</span></span></span><img src="wiki/easy-ide-book/common/images/topic.gif" /><br />
<br />
In Try 3, we displayed the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> data as a grid. In this chapter, we will concentrate on displaying <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> data using different types of charts.<br />
<br />
So, let’s start by taking a look at the program’s source code.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_3.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">1. Importing the 'CURL.GUI.CHARTS' package</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}</code></div></div><br />
The API needed to create a graph can be found the <span style="font-family: Courier;" class="mycode_font">CURL.GUI.CHARTS</span> package. By using an import statement to import this package, we can then use the necessary functions provided by the package.<br />
<br />
<hr class="mycode_hr" />
<br />
<img src="wiki/easy-ide-book/common/images/hint.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Packages</span></span></span><br />
<br />
A package contains logically grouped code. We can import packages and use the definitions in those packages.<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">2. Converting data to a graph</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField age, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, age = 33, score = 88},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, age = 27, score = 79},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, age = 26, score = 90}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</code></div></div><br />
To create a graph, we use the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> data. We’ll plot a graph for each <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordField</span></span> value in the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span>.<br />
<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_4.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">3. Creating a 'LayeredChart'</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>let chart:LayeredChart =<br />
&nbsp;&nbsp;&nbsp;&nbsp;{LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</code></div></div><br />
In the same way as for a bar or line graph, a <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span> requires that, prior to plotting any data, we define a 2-dimensional area with an x- and y-axis. We will next add the layer to our <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">LayeredChart</span></span> and then plot our graph.<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">4. Specifying a Layer</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{BarLayer<br />
&nbsp;&nbsp;&nbsp;&nbsp;...<br />
}</code></div></div><br />
We specify a layer to define the data to be plotted, as well as the plotting method (bar graph, line graph, etc.). In this example, in which we create a bar graph, we specify a <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">BarLayer</span></span>. Figure 4-5 shows the available layer types.<br />
<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_5.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">5. Specifying a label for the X-axis</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>x-axis-data = {ChartDataSeries data, name}</code></div></div><br />
The x-axis-data keyword argument controls the labeling of the x-axis. Using this argument, we can specify the field values used as captions on the -x-axis If we omit this argument, then an index starting from 0 is displayed on the x-axis. This x-axis information is specified using <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartDataSeries</span></span>.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_6.png" /><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">6. Specifying graph data</span></span></span><br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{ChartDataSeries data, score}</code></div></div><br />
We also use <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartDataSeries</span></span> to specify the data to be plotted on a graph. We specify the <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">RecordSet</span></span> containing the data, as well as the names of the fields we want to display on the graph. Although we can specify multiple <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">ChartDataSeries</span></span>, in this example, we specify only one.<br />
<br />
<hr class="mycode_hr" />
<br />
<img src="wiki/easy-ide-book/common/images/hint.gif" /><span style="font-size: large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">LayeredChart and PieChart</span></span></span><br />
<br />
Curl supports two main types of graphs. The first type plots data in two dimensions, using x- and y-axes, like the bar graph in the example in Try 4-1. This type of graph is created using LayeredChart. The second type is the pie graph. To create a pie graph, we use <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">PieChart</span></span>. For a pie graph, rather than specify each layer, we use <span style="color: #9400D3;" class="mycode_color"><span style="font-family: Courier;" class="mycode_font">PieSet</span></span> to specify the data to be plotted. By specifying multiple instances of PieSet, we can create a graph consisting of concentric circles. And, by using label-data, we can also display labels.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Page 1: Displaying Data as a Graph]]></title>
			<link>https://communities.curl.com/showthread.php?tid=63</link>
			<pubDate>Mon, 20 Jun 2011 02:59:16 +0000</pubDate>
			<guid isPermaLink="false">https://communities.curl.com/showthread.php?tid=63</guid>
			<description><![CDATA[<img src="wiki/easy-ide-book/common/images/try.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Try 4: Displaying Data as a Graph</span></span></span><br />
<br />
In this chapter, we’ll display our game scores as a graph.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Please download the <span style="font-family: Courier;" class="mycode_font">Try4.zip</span> file by selecting the following link: <span style="font-family: Courier;" class="mycode_font"><a href="http://developers.curl.com/wiki/easy-ide-book/try4/Try4.zip" target="_blank" rel="noopener" class="mycode_url">Try4.zip</a></span>. </span><br />
<br />
Unzip the contents to the <span style="font-family: Courier;" class="mycode_font">C:\Curl</span> directory. This is the working directory for all the examples and exercises contained within this tutorial. Note: If C:\Curl has not already been created, you can create it now.<br />
<br />
<img src="wiki/easy-ide-book/common/images/topic.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Basics: Displaying Data as a Graph</span></span></span><img src="wiki/easy-ide-book/common/images/topic.gif" /><br />
<br />
<img src="wiki/easy-ide-book/common/images/step1.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Create the 'Try 4-1' Project</span></span></span><br />
<br />
Close the Try 3 project and then, from the IDE 'File' menu, select 'New Project'. In the 'New Project' dialog box, select “Applet Project” (1), input “Try4-1” (2), specify <span style="font-family: Courier;" class="mycode_font">c:\Curl\lesson\Try4\01_bar_graph</span> in the “Directory” field (3), set the <span style="font-family: Courier;" class="mycode_font">API Version</span> to <span style="font-family: Courier;" class="mycode_font">6.0</span> (4), and then click OK (5).<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_1.png" /><br />
<br />
<img src="wiki/easy-ide-book/common/images/step2.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Inputting the Program</span></span></span><br />
<br />
Next, we’ll input the program. You can copy the program code below or use <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\01_bar_graph\start.curl</span> and then paste it into the editor in the IDE.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField age, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, age = 33, score = 88},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, age = 27, score = 79},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, age = 26, score = 90}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height = 5cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width = 10cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{BarLayer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x-axis-data = {ChartDataSeries data, name},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data, age}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
}</code></div></div><br />
<img src="wiki/easy-ide-book/common/images/step3.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Save the File, and then Execute the Program</span></span></span><br />
<br />
After inputting the code, save the file, and then execute the program. The following result will appear in your browser.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_2.png" /><br />
]]></description>
			<content:encoded><![CDATA[<img src="wiki/easy-ide-book/common/images/try.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Try 4: Displaying Data as a Graph</span></span></span><br />
<br />
In this chapter, we’ll display our game scores as a graph.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Please download the <span style="font-family: Courier;" class="mycode_font">Try4.zip</span> file by selecting the following link: <span style="font-family: Courier;" class="mycode_font"><a href="http://developers.curl.com/wiki/easy-ide-book/try4/Try4.zip" target="_blank" rel="noopener" class="mycode_url">Try4.zip</a></span>. </span><br />
<br />
Unzip the contents to the <span style="font-family: Courier;" class="mycode_font">C:\Curl</span> directory. This is the working directory for all the examples and exercises contained within this tutorial. Note: If C:\Curl has not already been created, you can create it now.<br />
<br />
<img src="wiki/easy-ide-book/common/images/topic.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Basics: Displaying Data as a Graph</span></span></span><img src="wiki/easy-ide-book/common/images/topic.gif" /><br />
<br />
<img src="wiki/easy-ide-book/common/images/step1.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Create the 'Try 4-1' Project</span></span></span><br />
<br />
Close the Try 3 project and then, from the IDE 'File' menu, select 'New Project'. In the 'New Project' dialog box, select “Applet Project” (1), input “Try4-1” (2), specify <span style="font-family: Courier;" class="mycode_font">c:\Curl\lesson\Try4\01_bar_graph</span> in the “Directory” field (3), set the <span style="font-family: Courier;" class="mycode_font">API Version</span> to <span style="font-family: Courier;" class="mycode_font">6.0</span> (4), and then click OK (5).<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_1.png" /><br />
<br />
<img src="wiki/easy-ide-book/common/images/step2.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Inputting the Program</span></span></span><br />
<br />
Next, we’ll input the program. You can copy the program code below or use <span style="font-family: Courier;" class="mycode_font">c:\Curl\Try4\01_bar_graph\start.curl</span> and then paste it into the editor in the IDE.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>{import * from CURL.GUI.CHARTS}<br />
{value<br />
&nbsp;&nbsp;&nbsp;&nbsp;let data:RecordSet =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordSet<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordFields<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField name, domain = String},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField age, domain = int},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordField score, domain = int}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Matt, age = 33, score = 88},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Sarah, age = 27, score = 79},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{RecordData name = Jacob, age = 26, score = 90}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;let chart:LayeredChart =<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{LayeredChart<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height = 5cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width = 10cm,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{BarLayer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x-axis-data = {ChartDataSeries data, name},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ChartDataSeries data, age}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;chart<br />
}</code></div></div><br />
<img src="wiki/easy-ide-book/common/images/step3.gif" /><span style="font-size: x-large;" class="mycode_size"><span style="font-family: Arial;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Save the File, and then Execute the Program</span></span></span><br />
<br />
After inputting the code, save the file, and then execute the program. The following result will appear in your browser.<br />
<img src="wiki/easy-ide-book/try4/images/figure_4_2.png" /><br />
]]></content:encoded>
		</item>
	</channel>
</rss>