1
1
# JavaScript Pyramid Chart
2
2
3
- ![ JavaScript Pyramid Chart] ( simplePyramid.png )
3
+ ![ JavaScript Pyramid Chart] ( simplePyramid-darkGold .png )
4
4
5
5
This demo application belongs to the set of examples for LightningChart JS, data visualization library for JavaScript.
6
6
7
7
LightningChart JS is entirely GPU accelerated and performance optimized charting library for presenting massive amounts of data. It offers an easy way of creating sophisticated and interactive charts and adding them to your website or web application.
8
8
9
9
The demo can be used as an example or a seed project. Local execution requires the following steps:
10
10
11
- - Make sure that relevant version of [ Node.js] ( https://nodejs.org/en/download/ ) is installed
12
- - Open the project folder in a terminal:
11
+ - Make sure that relevant version of [ Node.js] ( https://nodejs.org/en/download/ ) is installed
12
+ - Open the project folder in a terminal:
13
13
14
- npm install # fetches dependencies
15
- npm start # builds an application and starts the development server
14
+ npm install # fetches dependencies
15
+ npm start # builds an application and starts the development server
16
16
17
- - The application is available at * http ://localhost:8080 * in your browser, webpack-dev-server provides hot reload functionality.
17
+ - The application is available at _ http ://localhost:8080 _ in your browser, webpack-dev-server provides hot reload functionality.
18
18
19
19
20
20
## Description
@@ -33,7 +33,9 @@ By default, the LabelsOnSides type is used.
33
33
34
34
``` javascript
35
35
// Create a new Pyramid Chart and pass the type to use when placing labels.
36
- const pyramid = lightningChart ().Pyramid ( { type: PyramidChartTypes .LabelsOnSides } )
36
+ const pyramid = lightningChart ().Pyramid ({
37
+ type: PyramidChartTypes .LabelsOnSides ,
38
+ })
37
39
```
38
40
39
41
After creating the Pyramid Chart, we can populate it by adding slices to it.
@@ -43,52 +45,54 @@ You can alternatively add multiple slices as an array of objects containing a na
43
45
44
46
``` javascript
45
47
// Add a single slice to populate the Pyramid.
46
- pyramid .addSlice ( ' Planning' , 100 )
48
+ pyramid .addSlice (' Planning' , 100 )
47
49
48
50
// Add multiple slices to populate the Pyramid.
49
51
pyramid .addSlices ([
50
52
{
51
- name: ' Slice1' , value: 45
52
- }, {
53
- name: ' Slice2' , value: 83
54
- }, {
55
- name: ' Slice3' , value: 19
56
- }
57
- ])
58
-
53
+ name: ' Slice1' ,
54
+ value: 45 ,
55
+ },
56
+ {
57
+ name: ' Slice2' ,
58
+ value: 83 ,
59
+ },
60
+ {
61
+ name: ' Slice3' ,
62
+ value: 19 ,
63
+ },
64
+ ])
59
65
```
60
66
61
67
You can modify how the Pyramid and its slices are drawn through the Pyramid Chart's API.
62
68
63
69
``` javascript
64
70
// Set the width of the Pyramid's bottom edge. This value can be from 0 to 100 (in percents).
65
- pyramid .setNeckWidth ( 80 )
71
+ pyramid .setNeckWidth (80 )
66
72
67
73
// Set the gap between each of the slices. This value can be between 0 to 20 pixels.
68
- pyramid .setSliceGap ( 5 )
74
+ pyramid .setSliceGap (5 )
69
75
70
76
// If the labels are set to be placed on the side of the Pyramid,
71
77
// we can determine the side here as well.
72
- pyramid .setLabelSide ( PyramidLabelSide .Right )
73
-
78
+ pyramid .setLabelSide (PyramidLabelSide .Right )
74
79
```
75
80
76
81
The Slices can be styled using the Pyramid Chart's API.
77
82
78
83
``` javascript
79
84
// Create a palette of Solid FillStyles to use with the Pyramid slices.
80
- const palette = SolidFillPalette ( ColorPalettes .warm , data .length )
85
+ const palette = SolidFillPalette (ColorPalettes .warm , data .length )
81
86
// Set the palette used for coloring each of the slices.
82
- pyramid .setSliceFillStyle ( palette )
83
-
87
+ pyramid .setSliceFillStyle (palette)
84
88
```
85
89
86
90
The labels for all slices can be formatted in different ways.
87
91
88
92
``` javascript
89
93
// Set the label formatting to show the slice's name and the relative value
90
94
// (size of the slice as percentage).
91
- pyramid .setLabelFormatter ( SliceLabelFormatters .NamePlusRelativeValue )
95
+ pyramid .setLabelFormatter (SliceLabelFormatters .NamePlusRelativeValue )
92
96
```
93
97
94
98
The lines connecting each slice to its label can be modified.
@@ -98,10 +102,8 @@ The lines connecting each slice to its label can be modified.
98
102
pyramid .setLabelConnectorStyle (
99
103
new SolidLine ({
100
104
thickness: 3 ,
101
- fillStyle: new SolidFill (
102
- { color: ColorRGBA ( 100 , 150 , 195 ) }
103
- )
104
- })
105
+ fillStyle: new SolidFill ({ color: ColorRGBA (100 , 150 , 195 ) }),
106
+ }),
105
107
)
106
108
```
107
109
@@ -122,29 +124,29 @@ pyramid.setLabelConnectorStyle(
122
124
123
125
If you notice an error in the example code, please open an issue on [ GitHub] [ 0 ] repository of the entire example.
124
126
125
- Official [ API documentation] [ 1 ] can be found on [ Arction ] [ 2 ] website.
127
+ Official [ API documentation] [ 1 ] can be found on [ LightningChart ] [ 2 ] website.
126
128
127
129
If the docs and other materials do not solve your problem as well as implementation help is needed, ask on [ StackOverflow] [ 3 ] (tagged lightningchart).
128
130
129
- If you think you found a bug in the LightningChart JavaScript library, please contact support@arction .com .
131
+ If you think you found a bug in the LightningChart JavaScript library, please contact support@lightningchart .com .
130
132
131
- Direct developer email support can be purchased through a [ Support Plan] [ 4 ] or by contacting sales@arction .com .
133
+ Direct developer email support can be purchased through a [ Support Plan] [ 4 ] or by contacting sales@lightningchart .com .
132
134
133
135
[ 0 ] : https://github.com/Arction/
134
- [ 1 ] : https://www.arction .com/lightningchart-js-api-documentation/
135
- [ 2 ] : https://www.arction .com
136
+ [ 1 ] : https://lightningchart .com/lightningchart-js-api-documentation/
137
+ [ 2 ] : https://lightningchart .com
136
138
[ 3 ] : https://stackoverflow.com/questions/tagged/lightningchart
137
- [ 4 ] : https://www.arction .com/support-services/
139
+ [ 4 ] : https://lightningchart .com/support-services/
138
140
139
- © Arction Ltd 2009-2020 . All rights reserved.
141
+ © LightningChart Ltd 2009-2022 . All rights reserved.
140
142
141
143
142
- [ Pyramid Chart ] : https://www.arction. com/lightningchart-js-api-documentation/v3.4 .0/classes/pyramidchart .html
143
- [ Pyramid Chart Types ] : https://www.arction. com/lightningchart-js-api-documentation/v3.4 .0/globals .html#pyramidcharttypes
144
- [ Pyramid Label Side ] : https://www.arction. com/lightningchart-js-api-documentation/v3.4 .0/enums/pyramidlabelside .html
145
- [ Slice label formatter ] : https://www.arction. com/lightningchart-js-api-documentation/v3.4 .0/globals .html#slicelabelformatter
146
- [ Palette ] : https://www.arction. com/lightningchart-js-api-documentation/v3.4 .0/globals .html#colorpalettes
147
- [ SolidFillPalette ] : https://www.arction. com/lightningchart-js-api-documentation/v3.4 .0/globals .html#solidfillpalette
148
- [ Solid Line ] : https://www.arction. com/lightningchart-js-api-documentation/v3.4 .0/classes/solidline .html
149
- [ Solid Fill ] : https://www.arction. com/lightningchart-js-api-documentation/v3.4 .0/classes/solidfill .html
144
+ [ Pyramid Chart ] : https://lightningchart. com/lightningchart-js-api-documentation/v4.0 .0/classes/PyramidChart .html
145
+ [ Pyramid Chart Types ] : https://lightningchart. com/lightningchart-js-api-documentation/v4.0 .0/variables/PyramidChartTypes-1 .html
146
+ [ Pyramid Label Side ] : https://lightningchart. com/lightningchart-js-api-documentation/v4.0 .0/enums/PyramidLabelSide .html
147
+ [ Slice label formatter ] : https://lightningchart. com/lightningchart-js-api-documentation/v4.0 .0/types/SliceLabelFormatter .html
148
+ [ Palette ] : https://lightningchart. com/lightningchart-js-api-documentation/v4.0 .0/variables/ColorPalettes .html
149
+ [ SolidFillPalette ] : https://lightningchart. com/lightningchart-js-api-documentation/v4.0 .0/functions/SolidFillPalette .html
150
+ [ Solid Line ] : https://lightningchart. com/lightningchart-js-api-documentation/v4.0 .0/classes/SolidLine .html
151
+ [ Solid Fill ] : https://lightningchart. com/lightningchart-js-api-documentation/v4.0 .0/classes/SolidFill .html
150
152
0 commit comments