Basic Charts
- The letter is the numeric axis: ChartY, ChartX, or ChartXY.
- Switch to a different chart for variations.
- Set axis titles and appearance in the chart editor.
Introduction
The letter is the numeric axis. ChartY puts values on Y and categories on X. ChartX puts values on X and categories on Y. ChartXY is a 2D point space: both axes are numeric. Each record has a name and a list of points. The chart owns its kind, arrangement, axis titles, and appearance. Bar, line, area, pie, and doughnut share ChartY. Horizontal bars use ChartX. Line and area charts in 2D space use ChartXY.
- Declare one of the types below in Page Script.
- In Plug mode, open the chart and enter the variable name, such as
values, in its data field. - Choose the chart type and, for bar or area charts, the arrangement. Set axis titles and appearance there too.
The three contracts below are built in; no type declaration is required. Point types stay as the records inside values.
Named lists align by coordinates, never array index. Missing data remains a gap. Percentage stacks require non-negative values and a positive total at each coordinate.
Basic overview
Current implementation scope.
ChartY
Y holds the numbers. X names the categories. One named list draws a bar, line, area, pie, or doughnut.
Fields: name: string, values: ChartYPoint[]
1ChartY values = {2 name: "Sales",3 values: [4 { x: "Jan", y: 120 },5 { x: "Feb", y: 140 },6 { x: "Mar", y: 110 },7 { x: "Apr", y: 180 }8 ]9}ChartX
The X axis holds the numbers. The Y axis names the categories. A bar chart is horizontal. Choose Grouped, Stacked, or 100% stacked in the chart settings.
Fields: name: string, values: ChartXPoint[]
1ChartX values = {2 name: "Sales",3 values: [4 { x: 120, y: "Jan" },5 { x: 140, y: "Feb" },6 { x: 110, y: "Mar" },7 { x: 180, y: "Apr" }8 ]9}ChartXY
Both axes are numeric, so each point sits in a 2D space. Use line or area charts. Every point needs a non-empty label. ChartXY cannot be used for bars, pies, or doughnuts.
Fields: name: string, values: ChartXYPoint[]
1ChartXY values = {2 name: "East",3 values: [4 { x: 60, y: 30, label: "Pears" },5 { x: 90, y: 45, label: "Oranges" },6 { x: 120, y: 60, label: "Apples" }7 ]8}Comparing groups
Add [] when you compare groups. ChartY[], ChartX[], and ChartXY[] are lists of the same named records. Lists align by coordinate, not by array index.
1ChartY[] values = [2 { name: "Apples", values: [3 { x: "Jan", y: 120 },4 { x: "Feb", y: 140 },5 { x: "Mar", y: 110 },6 { x: "Apr", y: 180 }7 ] },8 { name: "Oranges", values: [9 { x: "Jan", y: 90 },10 { x: "Feb", y: 100 },11 { x: "Mar", y: 130 },12 { x: "Apr", y: 120 }13 ] }14]Common Mistakes
Keep numbers numeric. Two text coordinates are not a basic chart point. A numeric X/Y point needs a non-empty label, and duplicate coordinates within one named list are rejected. Bar and slice charts require a category; numeric X/Y uses line or area.
Use more than one named list to compare groups. Percentage stacks need a positive total at every coordinate. Stacks and slices reject more than 256 displayed points rather than changing the meaning of totals. Intermediate and advanced examples are proposed contracts.
