Thread Rating:
  • 350 Vote(s) - 2.77 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Page 3: Application 1: Specifying the Graph Axes
06-20-2011, 01:05 PM, (This post was last modified: 06-23-2011, 04:17 PM by ashimo.)
#1
Page 3: Application 1: Specifying the Graph Axes
Application 1: Specifying the graph axes

Next, we’ll specify the gradations and positions of the graph axes.

Create the 'Try 4-2' Project

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 c:\Curl\lesson\Try4\02_set_axis in the “Directory” field (3), set the API Version to 6.0 (4), and then click OK (5).


Inputting the Program

Next, we’ll input the program. You can copy the program code below or use c:\Curl\Try4\02_set_axis\start.curl and then paste it into the editor in the IDE.

Code:
{import * from CURL.GUI.CHARTS}
{value
    let data:RecordSet = {RecordSet
                             {RecordFields
                                 {RecordField name, domain = String},
                                 {RecordField age, domain = int},
                                 {RecordField score, domain = int}
                             },
                             {RecordData name = Matt, age = 33, score = 88},
                             {RecordData name = Sarah, age = 27, score = 79},
                             {RecordData name = Jacob, age = 26, score = 90}
                         }
    
    let chart:LayeredChart = {LayeredChart
                                 height = 5cm,
                                 width = 10cm,
                                 top-axis = {ChartAxis {ChartDataSeries data, name}},
                                 left-axis = {ChartAxis {ChartDataSeries data, age}},
                                 right-axis = {{NumericDataSeriesAxis-of float}
                                                  force-zero? = false,
                                                  {ChartDataSeries data, score}
                                              },
                                 {LineLayer
                                     {ChartDataSeries data, score},
                                     {ChartDataSeries data, age}
                                 }
                             }
    {VBox
        {RecordGrid
            record-source = data,
            height = 3cm,
            width = 10cm
        },
        chart
    }
}

Save the File, and then Execute the Program

After inputting the code, save the file, and then execute the program. The following result will appear in your browser.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Page 5: Application 2: Specifying the Graph Colors ashimo 1 5,713 11-19-2016, 01:59 PM
Last Post: milijacob
  Page 8: Extra Practice ashimo 0 3,614 06-20-2011, 01:10 PM
Last Post: ashimo
  Page 7: Summary ashimo 0 3,275 06-20-2011, 01:09 PM
Last Post: ashimo
  Page 6: Structure of a Program that Specifies the Graph Colors ashimo 0 3,419 06-20-2011, 01:08 PM
Last Post: ashimo
  Page 4: Structure of a Program that Specifies the Graph Axes ashimo 0 3,489 06-20-2011, 01:06 PM
Last Post: ashimo
  Page 2: Structure of a Program that Displays Data as a Graph ashimo 0 3,404 06-20-2011, 01:03 PM
Last Post: ashimo
  Page 1: Displaying Data as a Graph ashimo 0 3,153 06-20-2011, 11:59 AM
Last Post: ashimo
Forum Jump:


Users browsing this thread:
1 Guest(s)