ChartDataOptions
ChartDataOptions ( scanDirection ; sortSeriesIndex ; notEnoughDataFlag )
| Argument | Type | Range | Default | Note |
|---|---|---|---|---|
| scanDirection | int | 1..3 | xxyy | |
| sortSeriesIndex | int | -10000..10000 | 0 | xmCHART 5.0.5 or higher required |
| notEnoughDataFlag | int | 1..2 | 1 | xmCHART 5.0.5 or higher required |
Examples
ChartData(23 45;34 67;11 76;12 56;44 21)
ChartDataOptions(;1) /* Sort first series in ascending order. */
ChartDataOptions(;-1) /* Sort first series in descending order. */
ChartDataOptions(;;1) /* Return error message if not enough data available (default). */
ChartDataOptions(;;2) /* Ignore chart if not enough data available. */
Description
As the default, the values of a chart series are entered successively (scanDirection = xxyy). Example:
ChartData(2 3 -10 5; /* 1st series. */
3 9 12 -3) /* 2nd series. */
However, from time to time, it can be advantageous to enter the data in transposed form, i.e. the rows and columns are switched (scanDirection = xyxy and scanDirection = xyxy2). Example:
For example, several data series from a sequence of FileMaker Pro records can be transferred in transposed form to ChartData() via one single loop. Otherwise, if not in transposed form, a separate loop for each data series is necessary.
| | CHART_DATA_OPTIONS_01 |
| 1 | OpenDrawing(250;150) |
| 2 | |
| 3 | ChartData(23 18; |
| 4 | 19 12; |
| 5 | 10 19; |
| 6 | 15 24; |
| 7 | 13 17; |
| 8 | 5 15; |
| 9 | 2 6) |
| 10 | |
| 11 | /* Set up styles. */ |
| 12 | |
| 13 | |
| 14 | SymbolStyle(1;circle;4.5;1;#3879aa;;white) |
| 15 | SymbolStyle(2;circle;4.5;1;#c002a0;;white) |
| 16 | /* Set up axes. */ |
| 17 | |
| 18 | AxisMajorTicks(x;5;0.25;#333;;out) |
| 19 | AxisMajorTicks(y;0) |
| 20 | /* Set up grid. */ |
| 21 | MajorGridLineWidths(y;x;0) /* Hide vertical grid lines. */ |
| 22 | MajorGridLineWidths(x;y;0.25) |
| 23 |
The following two scripts produce the same result:
(1) Not transposed: (default)
| | CHART_DATA_OPTIONS_02 |
| 1 | OpenDrawing(250;150) |
| 2 | ChartData(23 19 10 15 13 6 2; /* x-values. */ |
| 3 | 18 12 19 24 12 15 6) /* y-values. */ |
| 4 | |
| 5 | /* Set up styles. */ |
| 6 | |
| 7 | SymbolStyle(1;circle;4.5;1;#3879aa;;white) |
| 8 | /* Set up axes. */ |
| 9 | |
| 10 | AxisMajorTicks(all;0) |
| 11 | /* Set up grid. */ |
| 12 | MajorGridLineWidths(all;all;0.25) |
| 13 |
(2) Transposed:
| | CHART_DATA_OPTIONS_03 |
| 1 | OpenDrawing(250;150) |
| 2 | |
| 3 | ChartData(23 18; |
| 4 | 19 12; |
| 5 | 10 19; |
| 6 | 15 24; |
| 7 | 13 12; |
| 8 | 6 15; |
| 9 | 2 6) |
| 10 | |
| 11 | /* Set up styles. */ |
| 12 | |
| 13 | SymbolStyle(1;circle;4.5;1;#3879aa;;white) |
| 14 | /* Set up axes. */ |
| 15 | |
| 16 | AxisMajorTicks(all;0) |
| 17 | /* Set up grid. */ |
| 18 | MajorGridLineWidths(all;all;0.25) |
| 19 |
Optional, data series can be transferred in transposed form to ChartData() by using scanDirection = xyxy2. For example:
| | CHART_DATA_OPTIONS_04 |
| 1 | OpenDrawing(250;150) |
| 2 | |
| 3 | ChartData(23 18 |
| 4 | 19 12 |
| 5 | 10 19 |
| 6 | 15 24 |
| 7 | 13 12 |
| 8 | 6 15 |
| 9 | 2 6; |
| 10 | 10 10 |
| 11 | 20 3) |
| 12 | |
| 13 | /* Set up styles. */ |
| 14 | |
| 15 | |
| 16 | SymbolStyle(1;circle;4.5;1;#3879aa;;white) |
| 17 | SymbolStyle(2;circle;4.5;1;#c002a0;;white) |
| 18 | /* Set up axes. */ |
| 19 | |
| 20 | AxisMajorTicks(all;0) |
| 21 | /* Set up grid. */ |
| 22 | MajorGridLineWidths(all;all;0.25) |
| 23 |
By using the 2nd argument sortSeriesIndex symbols, bars or pies of a series can be sorted ascendingly (sortSeriesIndex = seriesIndex) or descendingly (sortSeriesIndex = –seriesIndex).
| | CHART_DATA_OPTIONS_05 |
| 1 | /* Sort in descending order. */ |
| 2 | OpenDrawing(250;150) |
| 3 | |
| 4 | ChartData(32 58 41 23 45 47 42 83 12 73 68) |
| 5 | ChartDataOptions(;-1) /* -1...Sort down. */ |
| 6 | |
| 7 | /* Set up styles and labels. */ |
| 8 | SymbolStyle(1;bullet;8;1;steelBlue;shaded) |
| 9 | LabelStyle(1;Verdana;9;plain;steelBlue) |
| 10 | |
| 11 | DropLineStyle(all;x;0.25;steelBlue) |
| 12 | /* Set up axes. */ |
| 13 | |
| 14 | AxisOptions(y;none) /* Hide y-axis. */ |
| 15 | |
| 16 | AxisMajorTicks(all;0) /* Hide tick marks. */ |
| 17 | AxisMajorTickLabelStyle(all;Verdana;10;plain;#444) |
| 18 | GridLocation(all;none) /* Hide grid. */ |
| 19 | |
| 20 |
| | CHART_DATA_OPTIONS_06 |
| 1 | OpenDrawing(250;150) |
| 2 | ChartDataOptions(;1) /* +1...Sort up. */ |
| 3 | ChartData(11 13 7 17 6) |
| 4 | BarChart(label+horizontal;75) |
| 5 | /* Set up styles. */ |
| 6 | FillStyle(1;#4682b488) |
| 7 | |
| 8 | /* Set up axes. */ |
| 9 | |
| 10 | AxisMajorTicks(all;0) |
| 11 | /* Set up grid. */ |
| 12 | MajorGridLineWidths(y;x;0.25) |
| 13 | MajorGridLineWidths(x;y;0) |
| 14 |
| | CHART_DATA_OPTIONS_07 |
| 1 | OpenDrawing(500;150) |
| 2 | |
| 3 | ChartDataOptions(;-1) /* -1...Sort down 1st series. */ |
| 4 | ChartData( 4 13 9 18 7; |
| 5 | 12 17 14 9 3 12; |
| 6 | 9 10 11 6 12 3) |
| 7 | BarChart(;;-50) |
| 8 | /* Set up styles. */ |
| 9 | FillStyle(1;#005ca9a0) |
| 10 | FillStyle(2;#00afefa0) |
| 11 | FillStyle(3;#cbdb29) |
| 12 | |
| 13 | /* Set up axes. */ |
| 14 | |
| 15 | AxisMajorTicks(all;0) |
| 16 | /* Set up grid. */ |
| 17 | MajorGridLineWidths(x;y;0.25) |
| 18 | MajorGridLineWidths(y;x;0) |
| 19 | |
| 20 | |
| 21 | ChartDataOptions(;-2) /* -2...Sort down 2nd series. */ |
| 22 | ChartData( 4 13 9 18 7; |
| 23 | 12 17 14 9 3 12; |
| 24 | 9 10 11 6 12 3) |
| 25 | BarChart(;;-50) |
| 26 | /* Set up styles. */ |
| 27 | FillStyle(1;#005ca9a0) |
| 28 | FillStyle(2;#00afefa0) |
| 29 | FillStyle(3;#cbdb29) |
| 30 | |
| 31 | /* Set up axes. */ |
| 32 | |
| 33 | AxisMajorTicks(all;0) |
| 34 | /* Set up grid. */ |
| 35 | MajorGridLineWidths(x;y;0.25) |
| 36 | MajorGridLineWidths(y;x;0) |
| 37 | |
| 38 |
| | CHART_DATA_OPTIONS_08 |
| 1 | OpenDrawing(500;150) |
| 2 | |
| 3 | ChartDataOptions(;+1) /* +1...Sort up. */ |
| 4 | ChartData(9 4 0 28 10 null 15 8) |
| 5 | |
| 6 | /* Set up styles. */ |
| 7 | FillColorScheme(blue;shaded) |
| 8 | BorderStyle(all;;1.5;white) |
| 9 | |
| 10 | |
| 11 | ChartDataOptions(;-1) /* -1...Sort down. */ |
| 12 | ChartData(9 4 0 28 10 null 15 8) |
| 13 | |
| 14 | /* Set up styles. */ |
| 15 | FillColorScheme(blue;shaded) |
| 16 | BorderStyle(all;;1.5;white) |
| 17 | |
| 18 |
Using the 3rd argument notEnoughDataFlag = 2 proves to be advantageous, e.g. when combining (overlaying) 2 or more charts. Instead of returning an error message, charts not having enough data are simply ignored.