Data Source Chart Fields
Data Source Chart Field
The Data Source Chart draws a chart from a Data Source field (type 605) and shapes the data for you. Unlike the Custom Data Chart, which expects data already in chart shape, the Data Source Chart takes a table of rows and lets you choose which columns become the chart, how rows are combined, and how dates are grouped. Charts render for INTERNAL users only — on a form that is also used by Public users, set this field (and its Data Source) to display for internal users only.
How it gets data
You add a Data Source (605) field to the form, point it at a server expression that returns rows, and then bind this chart to it. The bound Data Source should resolve to one of:
- JSON rows (preferred) — an array of objects, for example [{"Vendor":"ACME","Total":1200,"Month":"Jan"}]. You map the columns by name below.
- Delimited — chart-shaped label^value^grouping;label2^value2^grouping2. This is already positional, so no column mapping is needed.
Settings
- Field Name — The internal name of the field.
- Chart Title — The title shown above the chart.
- Data Source — The Data Source field on this form that gathers this chart's data. Add a Data Source field to the form first, then bind it here. If the form has no Data Source fields yet, the editor prompts you to add one.
- Chart Type — Bar, Stacked Bar, Line, Pie or Doughnut.
- Aggregation — How to combine multiple rows that share the same Label (and Grouping). For example, many invoices on the same day for the same vendor become a single bar. Options: Sum, Count, Average, Minimum, Maximum, and None (no aggregation). Count ignores the Value column and counts rows. Use None when your data is already summarized and each row should stand alone.
- Date Bucket — When the Label column holds dates, group them into time buckets before aggregating: None (use the label as-is), Day, Week, Month, Quarter or Year. For example, Month turns daily invoices into one bar or point per month. Buckets are sorted chronologically. Leave at None for non-date labels or data that is already grouped.
Column Mapping
Map the Data Source columns to the chart's three roles by name. Leave any box blank to use the first columns positionally — 1st column = label, 2nd = value, 3rd = grouping.
- Label Column — The column used for the x-axis category or pie slice. Blank uses the 1st column.
- Value Column — The column used for the numeric value. Blank uses the 2nd column.
- Grouping Column — Optional. The column used to split bars or lines into series (the legend). Leave blank for a single series; blank otherwise falls back to the 3rd column.
Click to Field
- Click to Field — Optional. The field to update when a user clicks a data point. It receives a delimited string of the clicked Label, Value and Grouping — for example ACME^100.00^January.
Display
The Data Source Chart reuses the Chart (214) display panel, so it offers the same Alignment, Show Chart Legend, Chart Colors and Color Transparency options. Leave Chart Colors empty to use your branding colors; added colors are applied in order and reused if there are more groupings than colors. See the Chart Field (214) topic for the full description of these display options.
How the data is shaped (order of operations)
- Read rows from the bound Data Source (JSON rows, or parse delimited data positionally).
- Map columns to label/value/grouping by name, or positionally when the mapping boxes are blank.
- Bucket dates on the label when a Date Bucket other than None is chosen.
- Aggregate rows that share the same label (and grouping) using the chosen Aggregation.
- Sort date buckets chronologically, then draw.
Notes
- Several Data Source Charts can bind to the same Data Source and shape it different ways (different mappings, aggregations or buckets) without re-querying — the Data Source fetches once and all consumers share it.
- If a chart looks empty, confirm the Data Source actually resolved to rows (check its expression and the Please Wait behavior), and that the mapped column names match the data's column names.