APPX Software Library

Chapter 6: Create and Display a Chart

Build a Small APPX Chart

Start from a shipped 1CD chart close to the required result. The following sequence describes a small bar chart using the documented 0CD API. Define application work fields long enough for the chart name, returned path and result handling; use the parameter field types shown by the matching routine in your installed release.

  1. Initialize a one-dimensional dataset through .DATASET INITIALIZE and give it a name such as QUARTER SALES.
  2. Add values 120, 90 and 150 through three .POINT ADD NEW calls.
  3. Initialize an XY Chart with .CHART INITIALIZE. Use a distinct chart name for each independent specification.
  4. Add a bar layer through .XY ADD BAR LAYER. For this first single-dataset chart, use its documented automatic linking to the current dataset.
  5. Set the chart size and plot area, add labels Q1, Q2 and Q3, and apply a title.
  6. Render to a fresh filename by passing an alpha work field to .CHART RENDER with Share Y.
  7. Check the routine's result and display the returned pathname only after success.

For a process that repeatedly replaces its datasets or handles several series, turn off automatic linking and explicitly manage the data group, dataset template and dataset link. Otherwise a later layer can retain the previously current dataset. The dataset routines and bar layer documentation describe the contracts.