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

ChartDataOptions(xyxy)

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:

ChartData(2 3;​

3 9;​

-10 12;​

5 -3)

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

ChartDataOptions(xyxy)

3

ChartData(23 18;​

4

19 12;​

5

10 19;​

6

15 24;​

7

13 17;​

8

5 15;​

9

2 6)

10

LineChart(symbol;​on)

11

/* Set up styles. */

12

LineStyle(1;​poly;​1;​#3879aa)

13

LineStyle(2;​poly;​1;​#c002a0)

14

SymbolStyle(1;​circle;​4.5;​1;​#3879aa;​;​white)

15

SymbolStyle(2;​circle;​4.5;​1;​#c002a0;​;​white)

16

/* Set up axes. */

17

AxisLine(all;​0)

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

CloseDrawing()

CHART_DATA_OPTIONS_01

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

LineChart2D(symbol)

5

/* Set up styles. */

6

LineStyle(1;​poly;​1;​#3879aa)

7

SymbolStyle(1;​circle;​4.5;​1;​#3879aa;​;​white)

8

/* Set up axes. */

9

AxisLine(all;​0)

10

AxisMajorTicks(all;​0)

11

/* Set up grid. */

12

MajorGridLineWidths(all;​all;​0.25)

13

CloseDrawing()

CHART_DATA_OPTIONS_02

(2) Transposed:

CHART_DATA_OPTIONS_03
1

OpenDrawing(250;​150)

2

ChartDataOptions(xyxy)

3

ChartData(23 18;​

4

19 12;​

5

10 19;​

6

15 24;​

7

13 12;​

8

6 15;​

9

2 6)

10

LineChart2D(symbol)

11

/* Set up styles. */

12

LineStyle(1;​poly;​1;​#3879aa)

13

SymbolStyle(1;​circle;​4.5;​1;​#3879aa;​;​white)

14

/* Set up axes. */

15

AxisLine(all;​0)

16

AxisMajorTicks(all;​0)

17

/* Set up grid. */

18

MajorGridLineWidths(all;​all;​0.25)

19

CloseDrawing()

CHART_DATA_OPTIONS_03


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

ChartDataOptions(xyxy2)

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

LineChart2D(symbol)

13

/* Set up styles. */

14

LineStyle(1;​poly;​1;​#3879aa)

15

LineStyle(2;​poly;​1;​#c002a0)

16

SymbolStyle(1;​circle;​4.5;​1;​#3879aa;​;​white)

17

SymbolStyle(2;​circle;​4.5;​1;​#c002a0;​;​white)

18

/* Set up axes. */

19

AxisLine(all;​0)

20

AxisMajorTicks(all;​0)

21

/* Set up grid. */

22

MajorGridLineWidths(all;​all;​0.25)

23

CloseDrawing()

CHART_DATA_OPTIONS_04

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

OpenChart(20;​20;​210;​100;​on)

4

ChartData(32 58 41 23 45 47 42 83 12 73 68)

5

ChartDataOptions(;​-1) /* -1...Sort down. */

6

ScatterChart(label)

7

/* Set up styles and labels. */

8

SymbolStyle(1;​bullet;​8;​1;​steelBlue;​shaded)

9

LabelStyle(1;​Verdana;​9;​plain;​steelBlue)

10

LabelOptions(all;​topCenter)

11

DropLineStyle(all;​x;​0.25;​steelBlue)

12

/* Set up axes. */

13

Scaling(y;​linear;​0;​100;​10)

14

AxisOptions(y;​none) /* Hide y-axis.  */

15

AxisLine(all;​0) /* Hide axis lines. */

16

AxisMajorTicks(all;​0) /* Hide tick marks. */

17

AxisMajorTickLabelStyle(all;​Verdana;​10;​plain;​#444)

18

GridLocation(all;​none) /* Hide grid. */

19

CloseChart()

20

CloseDrawing()

CHART_DATA_OPTIONS_05
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

BorderStyle(all;​none)

8

/* Set up axes. */

9

AxisLine(all;​0)

10

AxisMajorTicks(all;​0)

11

/* Set up grid. */

12

MajorGridLineWidths(y;​x;​0.25)

13

MajorGridLineWidths(x;​y;​0)

14

CloseDrawing()

CHART_DATA_OPTIONS_06
CHART_DATA_OPTIONS_07
1

OpenDrawing(500;​150)

2

OpenChart(20;​20;​210;​100;​on)

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

BorderStyle(all;​none)

13

/* Set up axes. */

14

AxisLine(all;​0)

15

AxisMajorTicks(all;​0)

16

/* Set up grid. */

17

MajorGridLineWidths(x;​y;​0.25)

18

MajorGridLineWidths(y;​x;​0)

19

CloseChart()

20

OpenChart(270;​20;​210;​100;​on)

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

BorderStyle(all;​none)

31

/* Set up axes. */

32

AxisLine(all;​0)

33

AxisMajorTicks(all;​0)

34

/* Set up grid. */

35

MajorGridLineWidths(x;​y;​0.25)

36

MajorGridLineWidths(y;​x;​0)

37

CloseChart()

38

CloseDrawing()

CHART_DATA_OPTIONS_07
CHART_DATA_OPTIONS_08
1

OpenDrawing(500;​150)

2

OpenChart(20;​25;​210;​100;​on)

3

ChartDataOptions(;​+1) /* +1...Sort up. */

4

ChartData(9 4 0 28 10 null 15 8)

5

PieChart(oval+label)

6

/* Set up styles. */

7

FillColorScheme(blue;​shaded)

8

BorderStyle(all;​;​1.5;​white)

9

CloseChart()

10

OpenChart(270;​25;​210;​100;​on)

11

ChartDataOptions(;​-1) /* -1...Sort down. */

12

ChartData(9 4 0 28 10 null 15 8)

13

PieChart(oval+label)

14

/* Set up styles. */

15

FillColorScheme(blue;​shaded)

16

BorderStyle(all;​;​1.5;​white)

17

CloseChart()

18

CloseDrawing()

CHART_DATA_OPTIONS_08

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.

Scroll to Top