LineChart2D

Modified in version 5.0

LineChart2D ( appearanceConst ;​ splitAscentDescent )

Argument Type Range Default Note
appearanceConst int 0..127 default
splitAscentDescent int 0..1 off xmCHART 5.0.4 or higher required
Description

The LineChart2D() function makes it possible to draw two-dimensional line charts. The 1st data series in the ChartData() function provides the x-values, the 2nd data series the y-values for the first line series, the 3rd and 4th data series in ChartData() the x and y-values for the second line series, etc.

LINE_CHART_2D_01
1

OpenDrawing(250;​150)

2

ChartData(1 2 3 5 6 8;​ /* x-values. */

3

7 16 12 9 7 5) /* y-values. */

4

LineChart2D(symbol+shadow)

5

/* Set up styles. */

6

LineStyle(1;​poly;​1;​#4682b4)

7

SymbolStyle(1;​circle;​5;​1;​#4682b4;​;​white)

8

ShadowStyle(all;​2 2 3)

9

/* Set up axes. */

10

Scaling(y;​linear;​0)

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

AxisMajorTickLabelOptions(x;​;​;​3)

14

AxisMajorTickLabelOptions(y;​;​-3)

15

/* Set up grid. */

16

MajorGridLineWidths(x;​y;​0.25)

17

MajorGridLineWidths(y;​x;​0)

18

CloseDrawing()

LINE_CHART_2D_01
LINE_CHART_2D_02
1

OpenDrawing(250;​150)

2

ChartData( 7 11 18 20 24;​ /* 1st series: x-values. */

3

2 18 16 9 13;​ /* 1st series: y-values. */

4

23 10 15 12 6;​ /* 2nd series: x-values. */

5

3 10 15 5 4) /* 2nd series: y-values. */

6

LineChart2D()

7

/* Set up styles. */

8

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

9

LineStyle(2;​poly;​1.5;​#fdb910)

10

/* Set up axes. */

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

AxisMajorTickLabelOptions(x;​;​;​3)

14

AxisMajorTickLabelOptions(y;​;​-3)

15

/* Set up grid. */

16

MajorGridLineWidths(all;​all;​0.25)

17

GridFrame(xy;​0.5;​#888)

18

CloseDrawing()

LINE_CHART_2D_02

As for one-dimensional line charts, symbols (appearanceConstants = symbol), shadow (appearanceConstants = shadow) and labels (appearanceConstants = label) can also be added to the lines by using the argument appearanceConstants. The options can be combined arbitrarily by using a plus sign "+". Rotating (appearanceConstants = horizontal) is not supported for two-dimensional charts as this is simply possible by switching the data series in ChartData() .

LINE_CHART_2D_03
1

OpenDrawing(250;​150)

2

ChartData(25 15 10 15 15 6 0;​ /* x-values. */

3

18 10 19 24 17 14 8;​ /* y-values. */

4

0 25;​ 27 27;​ /* Upper border line. */

5

0 25;​ 5 5) /* Lower border line. */

6

LineChart2D(symbol)

7

/* Set up styles. */

8

LineStyle(1;​smooth;​1;​darkRed)

9

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

10

LineStyle(3;​poly;​2 2 2;​#3879aa)

11

SymbolStyle(1;​circle;​5;​1;​darkRed;​;​white)

12

SymbolStyle(2;​none)

13

SymbolStyle(3;​none)

14

/* Set up axes. */

15

AxisLine(all;​0)

16

AxisMajorTicks(all;​0)

17

AxisMajorTickLabelOptions(x;​;​;​3)

18

AxisMajorTickLabelOptions(y;​;​-3)

19

/* Set up grid. */

20

MajorGridLineWidths(all;​all;​0.25)

21

GridFrame(xy;​0.5;​#888)

22

CloseDrawing()

LINE_CHART_2D_03

By activating the 2nd argument splitAscentDescent = on, ascending and descending line segments are represented by different line styles. The appearance of the ascending line segments can be controlled by using style functions with odd series indices; the appearance of the descending line segments by using style functions with even series indices. This option is only available for polygonal lines, i.e. for line shape constant poly, for all other line shapes the argument splitAscentDescent is ignored.

LINE_CHART_2D_04
1

OpenDrawing(250;​150)

2

ChartData(2022-11-30 2022-12-01 2022-12-04 2022-12-06 2022-12-07 2022-12-08;​

3

12 15 12 14 17 12)

4

LineChart2D(label+symbol+shadow;​on)

5

/* Set up styles. */

6

LineStyle(1;​poly;​2.0;​steelBlue)

7

LineStyle(2;​poly;​2.0;​red)

8

SymbolStyle(1;​circle;​6;​1.5;​#fafafa;​;​steelBlue)

9

SymbolStyle(2;​circle;​6;​1.5;​#fafafa;​;​red)

10

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

11

LabelStyle(2;​Verdana;​9;​plain;​red)

12

LabelOptions(1;​topCenter;​;​2)

13

LabelOptions(2;​bottomCenter;​;​2)

14

ShadowStyle(all;​1 1 3)

15

/* Set up axes. */

16

Scaling(y;​linear;​10;​20;​5)

17

AxisLine(all;​0)

18

AxisMajorTicks(all;​0)

19

AxisMajorTickLabelTexts(y;​"")

20

AxisMajorTickLabelStyle(x;​;​;​;​#555;​;​-90)

21

AxisMajorTickLabelOptions(x;​;​;​5)

22

/* Set up grid. */

23

MajorGridLineColors(all;​all;​#ddd)

24

MajorGridLineWidths(x;​y;​0.25)

25

MajorGridLineWidths(y;​x;​0)

26

CloseDrawing()

LINE_CHART_2D_04
Scroll to Top