LineChart

Modified in version 5.0

LineChart ( appearanceConst ;​ doShiftIntervals ;​ splitAscentDescent )

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

The LineChart() function serves to draw one-dimensional line charts.

LINE_CHART_01
1

OpenDrawing(250;​150)

2

ChartData(12 14 8 17 9;​ /* 1st series. */

3

3 7 15 12 14) /* 2nd series. */

4

LineChart()

5

/* Set up styles. */

6

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

7

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

8

/* Set up axes. */

9

AxisLine(all;​0)

10

AxisMajorTicks(all;​0)

11

AxisMajorTickLabelOptions(x;​;​;​2)

12

AxisMajorTickLabelOptions(y;​;​-2)

13

/* Set up grid. */

14

MajorGridLineWidths(all;​all;​0.25)

15

GridFrame(xy;​0.5;​#888)

16

CloseDrawing()

LINE_CHART_01

The 1st argument appearanceConstants makes it possible to rotate the chart 90 degrees (appearanceConstants = horizontal) and to add symbols (appearanceConstants = symbol), shadow (appearanceConstants = shadow) and labels (appearanceConstants = label) to the lines. All options can be combined by using a plus sign "+".

LINE_CHART_02
1

OpenDrawing(250;​150)

2

ChartData(12 14 8 17 9;​ /* 1st series. */

3

3 7 15 12 14) /* 2nd series. */

4

LineChart(shadow+horizontal+symbol)

5

/* Set up styles. */

6

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

7

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

8

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

9

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

10

ShadowStyle(all;​2 2 3)

11

/* Set up axes. */

12

ScalingOptions(y;​on) /* y-scale top to bottom. */

13

AxisLine(all;​0)

14

AxisMajorTicks(all;​0)

15

AxisMajorTickLabelOptions(x;​;​;​3)

16

AxisMajorTickLabelOptions(y;​;​-3)

17

/* Set up grid. */

18

MajorGridLineWidths(x;​y;​0)

19

MajorGridLineWidths(y;​x;​0.25)

20

CloseDrawing()

LINE_CHART_02

The lines, symbols and shadows can be varied by using the style functions LineColorScheme() , LineStyle() , SymbolColorScheme() , SymbolStyle() and ShadowStyle() and the labels by using the five style functions LabelTexts() , LabelStyle() , LabelBackground() , LabelBackgroundOptions() and LabelOptions() .

LINE_CHART_03
1

OpenDrawing(250;​150)

2

ChartData(12 18 7 17 17;​ /* 1st series. */

3

3 7 17 13 13) /* 2nd series. */

4

LineChart(shadow+symbol)

5

/* Set up styles. */

6

LineColorScheme(16)

7

SymbolColorScheme(16)

8

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

9

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

10

ShadowStyle(all;​2 2 3)

11

/* Set up axes. */

12

AxisLine(all;​0)

13

AxisMajorTicks(all;​0)

14

AxisMajorTickLabelOptions(x;​;​;​3)

15

AxisMajorTickLabelOptions(y;​;​-3)

16

/* Set up grid. */

17

MajorGridLineWidths(x;​y;​0.25)

18

MajorGridLineWidths(y;​x;​0)

19

CloseDrawing()

LINE_CHART_03
LINE_CHART_04
1

OpenDrawing(250;​150)

2

ChartData(13 12 10 13 11;​ /* 1st series. */

3

3 7 2 8 5) /* 2nd series. */

4

LineChart(shadow+symbol)

5

/* Set up styles. */

6

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

7

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

8

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

9

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

10

ShadowStyle(all;​2 2 3)

11

/* Set up axes. */

12

AxisLine(all;​0)

13

AxisMajorTicks(all;​0)

14

AxisMajorTickLabelOptions(x;​;​;​3)

15

AxisMajorTickLabelOptions(y;​;​-3)

16

/* Set up grid. */

17

MajorGridLineWidths(x;​y;​0.25)

18

MajorGridLineWidths(y;​x;​0)

19

CloseDrawing()

LINE_CHART_04
LINE_CHART_05
1

OpenDrawing(250;​150)

2

ChartData(12 14 11 13 10;​

3

2 8 3 7 7)

4

LineChart(symbol+label+shadow)

5

/* Set up styles. */

6

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

7

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

8

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

9

SymbolStyle(2;​bullet;​15;​1;​#c002a0;​shaded)

10

ShadowStyle(all;​2 2 3)

11

LabelTexts(1;​"")

12

LabelStyle(2;​Verdana;​10;​bold;​white)

13

LabelOptions(2;​centerCenter;​;​-1)

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(x;​y;​0.25)

21

MajorGridLineWidths(y;​x;​0)

22

CloseDrawing()

LINE_CHART_05

For one-dimensional line charts it is possible to move the polygon points half an interval width so that they do not lie on the interval borders but rather in the middle of the intervals. This can be done by activating the 2nd argument doShiftIntervals = on.

LINE_CHART_06
1

OpenDrawing(250;​150)

2

ChartData(15 17 13 17 15 8)

3

LineChart(symbol+label;​on)

4

/* Set up styles. */

5

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

6

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

7

LabelOptions(1;​topCenter)

8

/* Set up axes. */

9

AxisLine(all;​0)

10

AxisMajorTicks(all;​0)

11

/* Set up grid. */

12

MajorGridLineWidths(x;​y;​0)

13

MajorGridLineWidths(y;​x;​0.25)

14

CloseDrawing()

LINE_CHART_06

In addition, it is possible to draw discontinuous lines by replacing the missing values in ChartData() with NULL.

LINE_CHART_07
1

OpenDrawing(250;​150)

2

ChartData(7 16 12 null 9 7 null 5)

3

LineChart(symbol+shadow;​on)

4

/* Set up styles. */

5

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

6

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

7

ShadowStyle(all;​2 2 3)

8

/* Set up axes. */

9

Scaling(y;​linear;​0)

10

AxisLine(all;​0)

11

AxisMajorTicks(all;​0)

12

AxisMajorTickLabelOptions(x;​;​;​3)

13

AxisMajorTickLabelOptions(y;​;​-3)

14

/* Set up grid. */

15

MajorGridLineWidths(x;​y;​0.25)

16

MajorGridLineWidths(y;​x;​0)

17

CloseDrawing()

LINE_CHART_07

By activating the 3rd 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_08
1

OpenDrawing(350;​150)

2

ChartData(11 14 11 15 15 19 16 15 9 15 14 14)

3

LineChart(label+symbol+shadow;​on;​on)

4

/* Set up styles. */

5

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

6

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

7

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

8

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

9

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

10

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

11

LabelBackground(all;​#fafafa;​;​0)

12

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

13

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

14

ShadowStyle(all;​1 1 3)

15

/* Set up axes. */

16

AxisLine(all;​0)

17

AxisMajorTicks(all;​0)

18

AxisMajorTickLabelOptions(x;​;​;​2)

19

AxisMajorTickLabelOptions(y;​;​-2)

20

AxisMajorTickLabelStyle(all;​;​;​;​#555)

21

/* Set up grid. */

22

MajorGridLineWidths(all;​all;​0.25)

23

MajorGridLineColors(all;​all;​#ddd)

24

CloseDrawing()

LINE_CHART_08
Scroll to Top