@exhaustive-ui/mcp 0.0.0-stage → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +167 -2
- package/data/components/accordion.md +421 -0
- package/data/components/animateonscroll.md +163 -0
- package/data/components/autocomplete.md +1077 -0
- package/data/components/autofocus.md +38 -0
- package/data/components/avatar.md +417 -0
- package/data/components/badge.md +234 -0
- package/data/components/blockui.md +108 -0
- package/data/components/breadcrumb.md +178 -0
- package/data/components/button.md +774 -0
- package/data/components/card.md +138 -0
- package/data/components/carousel.md +440 -0
- package/data/components/cascadeselect.md +1387 -0
- package/data/components/chart.md +1178 -0
- package/data/components/checkbox.md +529 -0
- package/data/components/chip.md +180 -0
- package/data/components/colorpicker.md +301 -0
- package/data/components/confirmdialog.md +287 -0
- package/data/components/confirmpopup.md +417 -0
- package/data/components/contextmenu.md +491 -0
- package/data/components/dataview.md +600 -0
- package/data/components/datepicker.md +1262 -0
- package/data/components/dialog.md +622 -0
- package/data/components/divider.md +250 -0
- package/data/components/dock.md +500 -0
- package/data/components/dragdrop.md +285 -0
- package/data/components/drawer.md +510 -0
- package/data/components/dynamicdialog.md +109 -0
- package/data/components/editor.md +291 -0
- package/data/components/fieldset.md +182 -0
- package/data/components/fileupload.md +430 -0
- package/data/components/floatlabel.md +155 -0
- package/data/components/fluid.md +72 -0
- package/data/components/focustrap.md +65 -0
- package/data/components/galleria.md +627 -0
- package/data/components/iconfield.md +246 -0
- package/data/components/iftalabel.md +105 -0
- package/data/components/imagecompare.md +97 -0
- package/data/components/inplace.md +233 -0
- package/data/components/inputgroup.md +306 -0
- package/data/components/inputmask.md +518 -0
- package/data/components/inputnumber.md +675 -0
- package/data/components/inputotp.md +336 -0
- package/data/components/inputtext.md +488 -0
- package/data/components/keyfilter.md +85 -0
- package/data/components/knob.md +462 -0
- package/data/components/listbox.md +798 -0
- package/data/components/llms.md +28 -0
- package/data/components/megamenu.md +587 -0
- package/data/components/menu.md +483 -0
- package/data/components/menubar.md +462 -0
- package/data/components/message.md +449 -0
- package/data/components/metergroup.md +241 -0
- package/data/components/multiselect.md +1047 -0
- package/data/components/orderlist.md +342 -0
- package/data/components/organizationchart.md +197 -0
- package/data/components/overlay.md +217 -0
- package/data/components/paginator.md +314 -0
- package/data/components/panel.md +214 -0
- package/data/components/panelmenu.md +699 -0
- package/data/components/password.md +570 -0
- package/data/components/picklist.md +420 -0
- package/data/components/popover.md +378 -0
- package/data/components/progressbar.md +181 -0
- package/data/components/progressspinner.md +91 -0
- package/data/components/radiobutton.md +377 -0
- package/data/components/rating.md +312 -0
- package/data/components/ripple.md +89 -0
- package/data/components/scroller.md +122 -0
- package/data/components/scrollpanel.md +149 -0
- package/data/components/scrolltop.md +105 -0
- package/data/components/select.md +1206 -0
- package/data/components/selectbutton.md +356 -0
- package/data/components/skeleton.md +242 -0
- package/data/components/slider.md +337 -0
- package/data/components/speeddial.md +589 -0
- package/data/components/splitbutton.md +945 -0
- package/data/components/splitter.md +196 -0
- package/data/components/stepper.md +411 -0
- package/data/components/styleclass.md +126 -0
- package/data/components/table.md +4557 -0
- package/data/components/tabs.md +467 -0
- package/data/components/tag.md +200 -0
- package/data/components/terminal.md +118 -0
- package/data/components/textarea.md +416 -0
- package/data/components/tieredmenu.md +578 -0
- package/data/components/timeline.md +310 -0
- package/data/components/toast.md +596 -0
- package/data/components/togglebutton.md +356 -0
- package/data/components/toggleswitch.md +285 -0
- package/data/components/toolbar.md +182 -0
- package/data/components/tooltip.md +211 -0
- package/data/components/tree.md +746 -0
- package/data/components/treeselect.md +912 -0
- package/data/components/treetable.md +2814 -0
- package/data/components.json +43751 -0
- package/data/llms-full.txt +47433 -0
- package/data/llms.txt +121 -0
- package/data/manifest.json +46513 -0
- package/data/pages/accessibility.md +28 -0
- package/data/pages/animations.md +28 -0
- package/data/pages/configuration.md +210 -0
- package/data/pages/contribution.md +20 -0
- package/data/pages/customicons.md +20 -0
- package/data/pages/faq.md +20 -0
- package/data/pages/icons.md +66 -0
- package/data/pages/installation.md +71 -0
- package/data/pages/llms.md +61 -0
- package/data/pages/passthrough.md +32 -0
- package/data/pages/philosophy.md +28 -0
- package/data/pages/primeflex.md +20 -0
- package/data/pages/rtl.md +12 -0
- package/data/pages/styled.md +132 -0
- package/data/pages/tailwind.md +40 -0
- package/data/pages/unstyled.md +39 -0
- package/data/snapshot.json +9 -0
- package/dist/index.d.mts +448 -0
- package/dist/index.mjs +2501 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -3
|
@@ -0,0 +1,1178 @@
|
|
|
1
|
+
# Angular Chart Component
|
|
2
|
+
|
|
3
|
+
Chart components are based on Charts.js 3.3.2+, an open source HTML5 based charting library.
|
|
4
|
+
|
|
5
|
+
## Accessibility
|
|
6
|
+
|
|
7
|
+
Screen Reader Chart components internally use canvas element, refer to the Chart.js accessibility guide for more information.
|
|
8
|
+
|
|
9
|
+
## Basic
|
|
10
|
+
|
|
11
|
+
A chart is configured with 3 properties; type , data and options . Chart type is defined using the type property that accepts pie , doughtnut , line , bar , radar and polarArea as a value. The data defines datasets represented with the chart and the options provide numerous customization options to customize the presentation.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
15
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
16
|
+
|
|
17
|
+
@Component({
|
|
18
|
+
template: `
|
|
19
|
+
<div class="card">
|
|
20
|
+
<p-chart type="bar" [data]="basicData" [options]="basicOptions" />
|
|
21
|
+
</div>
|
|
22
|
+
`,
|
|
23
|
+
standalone: true,
|
|
24
|
+
imports: [ChartModule]
|
|
25
|
+
})
|
|
26
|
+
export class ChartBasicDemo implements OnInit {
|
|
27
|
+
basicData: any;
|
|
28
|
+
basicOptions: any;
|
|
29
|
+
platformId = inject(PLATFORM_ID);
|
|
30
|
+
configService = inject(AppConfigService);
|
|
31
|
+
|
|
32
|
+
ngOnInit() {
|
|
33
|
+
this.initChart();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
initChart() {
|
|
37
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
38
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
39
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
40
|
+
const textColorSecondary = documentStyle.getPropertyValue('--p-text-muted-color');
|
|
41
|
+
const surfaceBorder = documentStyle.getPropertyValue('--p-content-border-color');
|
|
42
|
+
|
|
43
|
+
this.basicData = {
|
|
44
|
+
labels: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
45
|
+
datasets: [
|
|
46
|
+
{
|
|
47
|
+
label: 'Sales',
|
|
48
|
+
data: [540, 325, 702, 620],
|
|
49
|
+
backgroundColor: ['rgba(249, 115, 22, 0.2)', 'rgba(6, 182, 212, 0.2)', 'rgb(107, 114, 128, 0.2)', 'rgba(139, 92, 246, 0.2)'],
|
|
50
|
+
borderColor: ['rgb(249, 115, 22)', 'rgb(6, 182, 212)', 'rgb(107, 114, 128)', 'rgb(139, 92, 246)'],
|
|
51
|
+
borderWidth: 1
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
this.basicOptions = {
|
|
57
|
+
maintainAspectRatio: false,
|
|
58
|
+
aspectRatio: 0.8,
|
|
59
|
+
plugins: {
|
|
60
|
+
legend: {
|
|
61
|
+
labels: {
|
|
62
|
+
color: textColor
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
scales: {
|
|
67
|
+
x: {
|
|
68
|
+
ticks: {
|
|
69
|
+
color: textColorSecondary
|
|
70
|
+
},
|
|
71
|
+
grid: {
|
|
72
|
+
color: surfaceBorder
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
y: {
|
|
76
|
+
beginAtZero: true,
|
|
77
|
+
ticks: {
|
|
78
|
+
color: textColorSecondary
|
|
79
|
+
},
|
|
80
|
+
grid: {
|
|
81
|
+
color: surfaceBorder
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
this.cd.markForCheck();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Chart.js
|
|
93
|
+
|
|
94
|
+
To begin with, first you must install the charts.js package using npm and then include it in your project. An example with CLI would be;
|
|
95
|
+
|
|
96
|
+
## Combo
|
|
97
|
+
|
|
98
|
+
Different chart types can be combined in the same graph using the type option of a dataset.
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
102
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
103
|
+
|
|
104
|
+
@Component({
|
|
105
|
+
template: `
|
|
106
|
+
<div class="card">
|
|
107
|
+
<p-chart type="line" [data]="data" [options]="options" class="h-[30rem]" />
|
|
108
|
+
</div>
|
|
109
|
+
`,
|
|
110
|
+
standalone: true,
|
|
111
|
+
imports: [ChartModule]
|
|
112
|
+
})
|
|
113
|
+
export class ChartComboDemo implements OnInit {
|
|
114
|
+
data: any;
|
|
115
|
+
options: any;
|
|
116
|
+
platformId = inject(PLATFORM_ID);
|
|
117
|
+
configService = inject(AppConfigService);
|
|
118
|
+
|
|
119
|
+
ngOnInit() {
|
|
120
|
+
this.initChart();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
initChart() {
|
|
124
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
125
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
126
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
127
|
+
const textColorSecondary = documentStyle.getPropertyValue('--p-text-muted-color');
|
|
128
|
+
const surfaceBorder = documentStyle.getPropertyValue('--p-content-border-color');
|
|
129
|
+
|
|
130
|
+
this.data = {
|
|
131
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
132
|
+
datasets: [
|
|
133
|
+
{
|
|
134
|
+
type: 'line',
|
|
135
|
+
label: 'Dataset 1',
|
|
136
|
+
borderColor: documentStyle.getPropertyValue('--p-orange-500'),
|
|
137
|
+
borderWidth: 2,
|
|
138
|
+
fill: false,
|
|
139
|
+
tension: 0.4,
|
|
140
|
+
data: [50, 25, 12, 48, 56, 76, 42]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: 'bar',
|
|
144
|
+
label: 'Dataset 2',
|
|
145
|
+
backgroundColor: documentStyle.getPropertyValue('--p-gray-500'),
|
|
146
|
+
data: [21, 84, 24, 75, 37, 65, 34],
|
|
147
|
+
borderColor: 'white',
|
|
148
|
+
borderWidth: 2
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
type: 'bar',
|
|
152
|
+
label: 'Dataset 3',
|
|
153
|
+
backgroundColor: documentStyle.getPropertyValue('--p-cyan-500'),
|
|
154
|
+
data: [41, 52, 24, 74, 23, 21, 32]
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
this.options = {
|
|
160
|
+
maintainAspectRatio: false,
|
|
161
|
+
aspectRatio: 0.6,
|
|
162
|
+
plugins: {
|
|
163
|
+
legend: {
|
|
164
|
+
labels: {
|
|
165
|
+
color: textColor
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
scales: {
|
|
170
|
+
x: {
|
|
171
|
+
ticks: {
|
|
172
|
+
color: textColorSecondary
|
|
173
|
+
},
|
|
174
|
+
grid: {
|
|
175
|
+
color: surfaceBorder
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
y: {
|
|
179
|
+
ticks: {
|
|
180
|
+
color: textColorSecondary
|
|
181
|
+
},
|
|
182
|
+
grid: {
|
|
183
|
+
color: surfaceBorder
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
this.cd.markForCheck();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Doughnut
|
|
195
|
+
|
|
196
|
+
A doughnut chart is a variant of the pie chart, with a blank center allowing for additional information about the data as a whole to be included.
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
200
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
201
|
+
|
|
202
|
+
@Component({
|
|
203
|
+
template: `
|
|
204
|
+
<div class="card flex justify-center">
|
|
205
|
+
<p-chart type="doughnut" [data]="data" [options]="options" class="w-full md:w-[30rem]" />
|
|
206
|
+
</div>
|
|
207
|
+
`,
|
|
208
|
+
standalone: true,
|
|
209
|
+
imports: [ChartModule]
|
|
210
|
+
})
|
|
211
|
+
export class ChartDoughnutDemo implements OnInit {
|
|
212
|
+
data: any;
|
|
213
|
+
options: any;
|
|
214
|
+
platformId = inject(PLATFORM_ID);
|
|
215
|
+
configService = inject(AppConfigService);
|
|
216
|
+
|
|
217
|
+
ngOnInit() {
|
|
218
|
+
this.initChart();
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
initChart() {
|
|
222
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
223
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
224
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
225
|
+
|
|
226
|
+
this.data = {
|
|
227
|
+
labels: ['A', 'B', 'C'],
|
|
228
|
+
datasets: [
|
|
229
|
+
{
|
|
230
|
+
data: [300, 50, 100],
|
|
231
|
+
backgroundColor: [documentStyle.getPropertyValue('--p-cyan-500'), documentStyle.getPropertyValue('--p-orange-500'), documentStyle.getPropertyValue('--p-gray-500')],
|
|
232
|
+
hoverBackgroundColor: [documentStyle.getPropertyValue('--p-cyan-400'), documentStyle.getPropertyValue('--p-orange-400'), documentStyle.getPropertyValue('--p-gray-400')]
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
this.options = {
|
|
238
|
+
cutout: '60%',
|
|
239
|
+
plugins: {
|
|
240
|
+
legend: {
|
|
241
|
+
labels: {
|
|
242
|
+
color: textColor
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
this.cd.markForCheck();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Horizontal Bar
|
|
254
|
+
|
|
255
|
+
A bar chart is rendered horizontally when indexAxis option is set as y .
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
259
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
260
|
+
|
|
261
|
+
@Component({
|
|
262
|
+
template: `
|
|
263
|
+
<div class="card">
|
|
264
|
+
<p-chart type="bar" [data]="data" [options]="options" class="h-[30rem]" />
|
|
265
|
+
</div>
|
|
266
|
+
`,
|
|
267
|
+
standalone: true,
|
|
268
|
+
imports: [ChartModule]
|
|
269
|
+
})
|
|
270
|
+
export class ChartHorizontalbarDemo implements OnInit {
|
|
271
|
+
data: any;
|
|
272
|
+
options: any;
|
|
273
|
+
platformId = inject(PLATFORM_ID);
|
|
274
|
+
configService = inject(AppConfigService);
|
|
275
|
+
|
|
276
|
+
ngOnInit() {
|
|
277
|
+
this.initChart();
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
initChart() {
|
|
281
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
282
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
283
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
284
|
+
const textColorSecondary = documentStyle.getPropertyValue('--p-text-muted-color');
|
|
285
|
+
const surfaceBorder = documentStyle.getPropertyValue('--p-content-border-color');
|
|
286
|
+
|
|
287
|
+
this.data = {
|
|
288
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
289
|
+
datasets: [
|
|
290
|
+
{
|
|
291
|
+
label: 'My First dataset',
|
|
292
|
+
backgroundColor: documentStyle.getPropertyValue('--p-cyan-500'),
|
|
293
|
+
borderColor: documentStyle.getPropertyValue('--p-cyan-500'),
|
|
294
|
+
data: [65, 59, 80, 81, 56, 55, 40]
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
label: 'My Second dataset',
|
|
298
|
+
backgroundColor: documentStyle.getPropertyValue('--p-gray-500'),
|
|
299
|
+
borderColor: documentStyle.getPropertyValue('--p-gray-500'),
|
|
300
|
+
data: [28, 48, 40, 19, 86, 27, 90]
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
this.options = {
|
|
306
|
+
indexAxis: 'y',
|
|
307
|
+
maintainAspectRatio: false,
|
|
308
|
+
aspectRatio: 0.8,
|
|
309
|
+
plugins: {
|
|
310
|
+
legend: {
|
|
311
|
+
labels: {
|
|
312
|
+
color: textColor
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
scales: {
|
|
317
|
+
x: {
|
|
318
|
+
ticks: {
|
|
319
|
+
color: textColorSecondary,
|
|
320
|
+
font: {
|
|
321
|
+
weight: 500
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
grid: {
|
|
325
|
+
color: surfaceBorder,
|
|
326
|
+
drawBorder: false
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
y: {
|
|
330
|
+
ticks: {
|
|
331
|
+
color: textColorSecondary
|
|
332
|
+
},
|
|
333
|
+
grid: {
|
|
334
|
+
color: surfaceBorder,
|
|
335
|
+
drawBorder: false
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
this.cd.markForCheck();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Line
|
|
347
|
+
|
|
348
|
+
A line chart or line graph is a type of chart which displays information as a series of data points called 'markers' connected by straight line segments.
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
352
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
353
|
+
|
|
354
|
+
@Component({
|
|
355
|
+
template: `
|
|
356
|
+
<div class="card">
|
|
357
|
+
<p-chart type="line" [data]="data" [options]="options" class="h-[30rem]" />
|
|
358
|
+
</div>
|
|
359
|
+
`,
|
|
360
|
+
standalone: true,
|
|
361
|
+
imports: [ChartModule]
|
|
362
|
+
})
|
|
363
|
+
export class ChartLineDemo implements OnInit {
|
|
364
|
+
data: any;
|
|
365
|
+
options: any;
|
|
366
|
+
platformId = inject(PLATFORM_ID);
|
|
367
|
+
configService = inject(AppConfigService);
|
|
368
|
+
|
|
369
|
+
ngOnInit() {
|
|
370
|
+
this.initChart();
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
initChart() {
|
|
374
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
375
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
376
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
377
|
+
const textColorSecondary = documentStyle.getPropertyValue('--p-text-muted-color');
|
|
378
|
+
const surfaceBorder = documentStyle.getPropertyValue('--p-content-border-color');
|
|
379
|
+
|
|
380
|
+
this.data = {
|
|
381
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
382
|
+
datasets: [
|
|
383
|
+
{
|
|
384
|
+
label: 'First Dataset',
|
|
385
|
+
data: [65, 59, 80, 81, 56, 55, 40],
|
|
386
|
+
fill: false,
|
|
387
|
+
borderColor: documentStyle.getPropertyValue('--p-cyan-500'),
|
|
388
|
+
tension: 0.4
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
label: 'Second Dataset',
|
|
392
|
+
data: [28, 48, 40, 19, 86, 27, 90],
|
|
393
|
+
fill: false,
|
|
394
|
+
borderColor: documentStyle.getPropertyValue('--p-gray-500'),
|
|
395
|
+
tension: 0.4
|
|
396
|
+
}
|
|
397
|
+
]
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
this.options = {
|
|
401
|
+
maintainAspectRatio: false,
|
|
402
|
+
aspectRatio: 0.6,
|
|
403
|
+
plugins: {
|
|
404
|
+
legend: {
|
|
405
|
+
labels: {
|
|
406
|
+
color: textColor
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
scales: {
|
|
411
|
+
x: {
|
|
412
|
+
ticks: {
|
|
413
|
+
color: textColorSecondary
|
|
414
|
+
},
|
|
415
|
+
grid: {
|
|
416
|
+
color: surfaceBorder,
|
|
417
|
+
drawBorder: false
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
y: {
|
|
421
|
+
ticks: {
|
|
422
|
+
color: textColorSecondary
|
|
423
|
+
},
|
|
424
|
+
grid: {
|
|
425
|
+
color: surfaceBorder,
|
|
426
|
+
drawBorder: false
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
this.cd.markForCheck();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
## linestyle-doc
|
|
438
|
+
|
|
439
|
+
Various styles of a line series can be customized to display customizations like an area chart.
|
|
440
|
+
|
|
441
|
+
```typescript
|
|
442
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
443
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
444
|
+
|
|
445
|
+
@Component({
|
|
446
|
+
template: `
|
|
447
|
+
<div class="card">
|
|
448
|
+
<p-chart type="line" [data]="data" [options]="options" class="h-[30rem]" />
|
|
449
|
+
</div>
|
|
450
|
+
`,
|
|
451
|
+
standalone: true,
|
|
452
|
+
imports: [ChartModule]
|
|
453
|
+
})
|
|
454
|
+
export class ChartLinestyleDemo implements OnInit {
|
|
455
|
+
data: any;
|
|
456
|
+
options: any;
|
|
457
|
+
platformId = inject(PLATFORM_ID);
|
|
458
|
+
configService = inject(AppConfigService);
|
|
459
|
+
|
|
460
|
+
ngOnInit() {
|
|
461
|
+
this.initChart();
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
initChart() {
|
|
465
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
466
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
467
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
468
|
+
const textColorSecondary = documentStyle.getPropertyValue('--p-text-muted-color');
|
|
469
|
+
const surfaceBorder = documentStyle.getPropertyValue('--p-content-border-color');
|
|
470
|
+
|
|
471
|
+
this.data = {
|
|
472
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
473
|
+
datasets: [
|
|
474
|
+
{
|
|
475
|
+
label: 'First Dataset',
|
|
476
|
+
data: [65, 59, 80, 81, 56, 55, 40],
|
|
477
|
+
fill: false,
|
|
478
|
+
tension: 0.4,
|
|
479
|
+
borderColor: documentStyle.getPropertyValue('--p-cyan-500')
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
label: 'Second Dataset',
|
|
483
|
+
data: [28, 48, 40, 19, 86, 27, 90],
|
|
484
|
+
fill: false,
|
|
485
|
+
borderDash: [5, 5],
|
|
486
|
+
tension: 0.4,
|
|
487
|
+
borderColor: documentStyle.getPropertyValue('--p-orange-500')
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
label: 'Third Dataset',
|
|
491
|
+
data: [12, 51, 62, 33, 21, 62, 45],
|
|
492
|
+
fill: true,
|
|
493
|
+
borderColor: documentStyle.getPropertyValue('--p-gray-500'),
|
|
494
|
+
tension: 0.4,
|
|
495
|
+
backgroundColor: 'rgba(107, 114, 128, 0.2)'
|
|
496
|
+
}
|
|
497
|
+
]
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
this.options = {
|
|
501
|
+
maintainAspectRatio: false,
|
|
502
|
+
aspectRatio: 0.6,
|
|
503
|
+
plugins: {
|
|
504
|
+
legend: {
|
|
505
|
+
labels: {
|
|
506
|
+
color: textColor
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
scales: {
|
|
511
|
+
x: {
|
|
512
|
+
ticks: {
|
|
513
|
+
color: textColorSecondary
|
|
514
|
+
},
|
|
515
|
+
grid: {
|
|
516
|
+
color: surfaceBorder
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
y: {
|
|
520
|
+
ticks: {
|
|
521
|
+
color: textColorSecondary
|
|
522
|
+
},
|
|
523
|
+
grid: {
|
|
524
|
+
color: surfaceBorder
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
this.cd.markForCheck();
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
## methods-doc
|
|
536
|
+
|
|
537
|
+
```typescript
|
|
538
|
+
import { Component } from '@angular/core';
|
|
539
|
+
|
|
540
|
+
@Component({
|
|
541
|
+
template: `
|
|
542
|
+
<div class="doc-tablewrapper">
|
|
543
|
+
<table class="doc-table">
|
|
544
|
+
<thead>
|
|
545
|
+
<tr>
|
|
546
|
+
<th>Name</th>
|
|
547
|
+
<th>Parameters</th>
|
|
548
|
+
<th>Description</th>
|
|
549
|
+
</tr>
|
|
550
|
+
</thead>
|
|
551
|
+
<tbody>
|
|
552
|
+
<tr>
|
|
553
|
+
<td>refresh</td>
|
|
554
|
+
<td>-</td>
|
|
555
|
+
<td>Redraws the graph with new data.</td>
|
|
556
|
+
</tr>
|
|
557
|
+
<tr>
|
|
558
|
+
<td>reinit</td>
|
|
559
|
+
<td>-</td>
|
|
560
|
+
<td>Destroys the graph first and then creates it again.</td>
|
|
561
|
+
</tr>
|
|
562
|
+
<tr>
|
|
563
|
+
<td>generateLegend</td>
|
|
564
|
+
<td>-</td>
|
|
565
|
+
<td>Returns an HTML string of a legend for that chart. The legend is generated from the legendCallback in the options.</td>
|
|
566
|
+
</tr>
|
|
567
|
+
</tbody>
|
|
568
|
+
</table>
|
|
569
|
+
</div>
|
|
570
|
+
`,
|
|
571
|
+
standalone: true,
|
|
572
|
+
imports: []
|
|
573
|
+
})
|
|
574
|
+
export class ChartMethodsDemo {}
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
## MultiAxis
|
|
578
|
+
|
|
579
|
+
Multiple axes can be added using the scales option.
|
|
580
|
+
|
|
581
|
+
```typescript
|
|
582
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
583
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
584
|
+
|
|
585
|
+
@Component({
|
|
586
|
+
template: `
|
|
587
|
+
<div class="card">
|
|
588
|
+
<p-chart type="line" [data]="data" [options]="options" class="h-[30rem]" />
|
|
589
|
+
</div>
|
|
590
|
+
`,
|
|
591
|
+
standalone: true,
|
|
592
|
+
imports: [ChartModule]
|
|
593
|
+
})
|
|
594
|
+
export class ChartMultiaxisDemo implements OnInit {
|
|
595
|
+
data: any;
|
|
596
|
+
options: any;
|
|
597
|
+
platformId = inject(PLATFORM_ID);
|
|
598
|
+
configService = inject(AppConfigService);
|
|
599
|
+
|
|
600
|
+
ngOnInit() {
|
|
601
|
+
this.initChart();
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
initChart() {
|
|
605
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
606
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
607
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
608
|
+
const textColorSecondary = documentStyle.getPropertyValue('--p-text-muted-color');
|
|
609
|
+
const surfaceBorder = documentStyle.getPropertyValue('--p-content-border-color');
|
|
610
|
+
|
|
611
|
+
this.data = {
|
|
612
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
613
|
+
datasets: [
|
|
614
|
+
{
|
|
615
|
+
label: 'Dataset 1',
|
|
616
|
+
fill: false,
|
|
617
|
+
borderColor: documentStyle.getPropertyValue('--p-cyan-500'),
|
|
618
|
+
yAxisID: 'y',
|
|
619
|
+
tension: 0.4,
|
|
620
|
+
data: [65, 59, 80, 81, 56, 55, 10]
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
label: 'Dataset 2',
|
|
624
|
+
fill: false,
|
|
625
|
+
borderColor: documentStyle.getPropertyValue('--p-gray-500'),
|
|
626
|
+
yAxisID: 'y1',
|
|
627
|
+
tension: 0.4,
|
|
628
|
+
data: [28, 48, 40, 19, 86, 27, 90]
|
|
629
|
+
}
|
|
630
|
+
]
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
this.options = {
|
|
634
|
+
stacked: false,
|
|
635
|
+
maintainAspectRatio: false,
|
|
636
|
+
aspectRatio: 0.6,
|
|
637
|
+
plugins: {
|
|
638
|
+
legend: {
|
|
639
|
+
labels: {
|
|
640
|
+
color: textColor
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
scales: {
|
|
645
|
+
x: {
|
|
646
|
+
ticks: {
|
|
647
|
+
color: textColorSecondary
|
|
648
|
+
},
|
|
649
|
+
grid: {
|
|
650
|
+
color: surfaceBorder
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
y: {
|
|
654
|
+
type: 'linear',
|
|
655
|
+
display: true,
|
|
656
|
+
position: 'left',
|
|
657
|
+
ticks: {
|
|
658
|
+
color: textColorSecondary
|
|
659
|
+
},
|
|
660
|
+
grid: {
|
|
661
|
+
color: surfaceBorder
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
y1: {
|
|
665
|
+
type: 'linear',
|
|
666
|
+
display: true,
|
|
667
|
+
position: 'right',
|
|
668
|
+
ticks: {
|
|
669
|
+
color: textColorSecondary
|
|
670
|
+
},
|
|
671
|
+
grid: {
|
|
672
|
+
drawOnChartArea: false,
|
|
673
|
+
color: surfaceBorder
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
this.cd.markForCheck();
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
## Pie
|
|
685
|
+
|
|
686
|
+
A pie chart is a circular statistical graphic which is divided into slices to illustrate numerical proportion.
|
|
687
|
+
|
|
688
|
+
```typescript
|
|
689
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
690
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
691
|
+
|
|
692
|
+
@Component({
|
|
693
|
+
template: `
|
|
694
|
+
<div class="card flex justify-center">
|
|
695
|
+
<p-chart type="pie" [data]="data" [options]="options" class="w-full md:w-[30rem]" />
|
|
696
|
+
</div>
|
|
697
|
+
`,
|
|
698
|
+
standalone: true,
|
|
699
|
+
imports: [ChartModule]
|
|
700
|
+
})
|
|
701
|
+
export class ChartPieDemo implements OnInit {
|
|
702
|
+
data: any;
|
|
703
|
+
options: any;
|
|
704
|
+
platformId = inject(PLATFORM_ID);
|
|
705
|
+
configService = inject(AppConfigService);
|
|
706
|
+
|
|
707
|
+
ngOnInit() {
|
|
708
|
+
this.initChart();
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
initChart() {
|
|
712
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
713
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
714
|
+
const textColor = documentStyle.getPropertyValue('--text-color');
|
|
715
|
+
|
|
716
|
+
this.data = {
|
|
717
|
+
labels: ['A', 'B', 'C'],
|
|
718
|
+
datasets: [
|
|
719
|
+
{
|
|
720
|
+
data: [540, 325, 702],
|
|
721
|
+
backgroundColor: [documentStyle.getPropertyValue('--p-cyan-500'), documentStyle.getPropertyValue('--p-orange-500'), documentStyle.getPropertyValue('--p-gray-500')],
|
|
722
|
+
hoverBackgroundColor: [documentStyle.getPropertyValue('--p-cyan-400'), documentStyle.getPropertyValue('--p-orange-400'), documentStyle.getPropertyValue('--p-gray-400')]
|
|
723
|
+
}
|
|
724
|
+
]
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
this.options = {
|
|
728
|
+
plugins: {
|
|
729
|
+
legend: {
|
|
730
|
+
labels: {
|
|
731
|
+
usePointStyle: true,
|
|
732
|
+
color: textColor
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
this.cd.markForCheck();
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
## Polar Area
|
|
744
|
+
|
|
745
|
+
Polar area charts are similar to pie charts, but each segment has the same angle - the radius of the segment differs depending on the value.
|
|
746
|
+
|
|
747
|
+
```typescript
|
|
748
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
749
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
750
|
+
|
|
751
|
+
@Component({
|
|
752
|
+
template: `
|
|
753
|
+
<div class="card flex justify-center">
|
|
754
|
+
<p-chart type="polarArea" [data]="data" [options]="options" class="w-full md:w-[30rem]" />
|
|
755
|
+
</div>
|
|
756
|
+
`,
|
|
757
|
+
standalone: true,
|
|
758
|
+
imports: [ChartModule]
|
|
759
|
+
})
|
|
760
|
+
export class ChartPolarareaDemo implements OnInit {
|
|
761
|
+
data: any;
|
|
762
|
+
options: any;
|
|
763
|
+
platformId = inject(PLATFORM_ID);
|
|
764
|
+
configService = inject(AppConfigService);
|
|
765
|
+
|
|
766
|
+
ngOnInit() {
|
|
767
|
+
this.initChart();
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
initChart() {
|
|
771
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
772
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
773
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
774
|
+
const surfaceBorder = documentStyle.getPropertyValue('--p-content-border-color');
|
|
775
|
+
|
|
776
|
+
this.data = {
|
|
777
|
+
datasets: [
|
|
778
|
+
{
|
|
779
|
+
data: [11, 16, 7, 3, 14],
|
|
780
|
+
backgroundColor: [
|
|
781
|
+
documentStyle.getPropertyValue('--p-pink-500'),
|
|
782
|
+
documentStyle.getPropertyValue('--p-gray-500'),
|
|
783
|
+
documentStyle.getPropertyValue('--p-orange-500'),
|
|
784
|
+
documentStyle.getPropertyValue('--p-purple-500'),
|
|
785
|
+
documentStyle.getPropertyValue('--p-cyan-500')
|
|
786
|
+
],
|
|
787
|
+
label: 'My dataset'
|
|
788
|
+
}
|
|
789
|
+
],
|
|
790
|
+
labels: ['Pink', 'Gray', 'Orange', 'Purple', 'Cyan']
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
this.options = {
|
|
794
|
+
plugins: {
|
|
795
|
+
legend: {
|
|
796
|
+
labels: {
|
|
797
|
+
color: textColor
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
},
|
|
801
|
+
scales: {
|
|
802
|
+
r: {
|
|
803
|
+
grid: {
|
|
804
|
+
color: surfaceBorder
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
this.cd.markForCheck();
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
## props-doc
|
|
816
|
+
|
|
817
|
+
```typescript
|
|
818
|
+
import { Component } from '@angular/core';
|
|
819
|
+
|
|
820
|
+
@Component({
|
|
821
|
+
template: `
|
|
822
|
+
<div class="doc-tablewrapper">
|
|
823
|
+
<table class="doc-table">
|
|
824
|
+
<thead>
|
|
825
|
+
<tr>
|
|
826
|
+
<th>Name</th>
|
|
827
|
+
<th>Type</th>
|
|
828
|
+
<th>Default</th>
|
|
829
|
+
<th>Description</th>
|
|
830
|
+
</tr>
|
|
831
|
+
</thead>
|
|
832
|
+
<tbody>
|
|
833
|
+
<tr>
|
|
834
|
+
<td>type</td>
|
|
835
|
+
<td>string</td>
|
|
836
|
+
<td>null</td>
|
|
837
|
+
<td>Type of the chart.</td>
|
|
838
|
+
</tr>
|
|
839
|
+
<tr>
|
|
840
|
+
<td>data</td>
|
|
841
|
+
<td>any</td>
|
|
842
|
+
<td>null</td>
|
|
843
|
+
<td>Data to display.</td>
|
|
844
|
+
</tr>
|
|
845
|
+
<tr>
|
|
846
|
+
<td>options</td>
|
|
847
|
+
<td>any</td>
|
|
848
|
+
<td>null</td>
|
|
849
|
+
<td>Options to customize the chart.</td>
|
|
850
|
+
</tr>
|
|
851
|
+
<tr>
|
|
852
|
+
<td>plugins</td>
|
|
853
|
+
<td>any[]</td>
|
|
854
|
+
<td>null</td>
|
|
855
|
+
<td>Array of per-chart plugins to customize the chart behaviour.</td>
|
|
856
|
+
</tr>
|
|
857
|
+
<tr>
|
|
858
|
+
<td>width</td>
|
|
859
|
+
<td>string</td>
|
|
860
|
+
<td>null</td>
|
|
861
|
+
<td>Width of the chart.</td>
|
|
862
|
+
</tr>
|
|
863
|
+
<tr>
|
|
864
|
+
<td>height</td>
|
|
865
|
+
<td>string</td>
|
|
866
|
+
<td>null</td>
|
|
867
|
+
<td>Height of the chart.</td>
|
|
868
|
+
</tr>
|
|
869
|
+
<tr>
|
|
870
|
+
<td>responsive</td>
|
|
871
|
+
<td>boolean</td>
|
|
872
|
+
<td>true</td>
|
|
873
|
+
<td>Whether the chart is redrawn on screen size change.</td>
|
|
874
|
+
</tr>
|
|
875
|
+
<tr>
|
|
876
|
+
<td>onDataSelect</td>
|
|
877
|
+
<td>function</td>
|
|
878
|
+
<td>null</td>
|
|
879
|
+
<td>Callback to execute when an element on chart is clicked.</td>
|
|
880
|
+
</tr>
|
|
881
|
+
</tbody>
|
|
882
|
+
</table>
|
|
883
|
+
</div>
|
|
884
|
+
`,
|
|
885
|
+
standalone: true,
|
|
886
|
+
imports: []
|
|
887
|
+
})
|
|
888
|
+
export class ChartPropsDemo {}
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
## radar-doc
|
|
892
|
+
|
|
893
|
+
A radar chart is a graphical method of displaying multivariate data in the form of a two-dimensional chart of three or more quantitative variables represented on axes starting from the same point.
|
|
894
|
+
|
|
895
|
+
```typescript
|
|
896
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
897
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
898
|
+
|
|
899
|
+
@Component({
|
|
900
|
+
template: `
|
|
901
|
+
<div class="card flex justify-center">
|
|
902
|
+
<p-chart type="radar" [data]="data" [options]="options" class="w-full md:w-[30rem]" />
|
|
903
|
+
</div>
|
|
904
|
+
`,
|
|
905
|
+
standalone: true,
|
|
906
|
+
imports: [ChartModule]
|
|
907
|
+
})
|
|
908
|
+
export class ChartRadarDemo implements OnInit {
|
|
909
|
+
data: any;
|
|
910
|
+
options: any;
|
|
911
|
+
platformId = inject(PLATFORM_ID);
|
|
912
|
+
configService = inject(AppConfigService);
|
|
913
|
+
|
|
914
|
+
ngOnInit() {
|
|
915
|
+
this.initChart();
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
initChart() {
|
|
919
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
920
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
921
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
922
|
+
const textColorSecondary = documentStyle.getPropertyValue('--p-text-muted-color');
|
|
923
|
+
|
|
924
|
+
this.data = {
|
|
925
|
+
labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'],
|
|
926
|
+
datasets: [
|
|
927
|
+
{
|
|
928
|
+
label: 'My First dataset',
|
|
929
|
+
borderColor: documentStyle.getPropertyValue('--p-gray-400'),
|
|
930
|
+
pointBackgroundColor: documentStyle.getPropertyValue('--p-gray-400'),
|
|
931
|
+
pointBorderColor: documentStyle.getPropertyValue('--p-gray-400'),
|
|
932
|
+
pointHoverBackgroundColor: textColor,
|
|
933
|
+
pointHoverBorderColor: documentStyle.getPropertyValue('--p-gray-400'),
|
|
934
|
+
data: [65, 59, 90, 81, 56, 55, 40]
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
label: 'My Second dataset',
|
|
938
|
+
borderColor: documentStyle.getPropertyValue('--p-cyan-400'),
|
|
939
|
+
pointBackgroundColor: documentStyle.getPropertyValue('--p-cyan-400'),
|
|
940
|
+
pointBorderColor: documentStyle.getPropertyValue('--p-cyan-400'),
|
|
941
|
+
pointHoverBackgroundColor: textColor,
|
|
942
|
+
pointHoverBorderColor: documentStyle.getPropertyValue('--p-cyan-400'),
|
|
943
|
+
data: [28, 48, 40, 19, 96, 27, 100]
|
|
944
|
+
}
|
|
945
|
+
]
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
this.options = {
|
|
949
|
+
plugins: {
|
|
950
|
+
legend: {
|
|
951
|
+
labels: {
|
|
952
|
+
color: textColor
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
},
|
|
956
|
+
scales: {
|
|
957
|
+
r: {
|
|
958
|
+
grid: {
|
|
959
|
+
color: textColorSecondary
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
this.cd.markForCheck();
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
## Stacked Bar
|
|
971
|
+
|
|
972
|
+
Bars can be stacked on top of each other when stacked option of a scale is enabled.
|
|
973
|
+
|
|
974
|
+
```typescript
|
|
975
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
976
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
977
|
+
|
|
978
|
+
@Component({
|
|
979
|
+
template: `
|
|
980
|
+
<div class="card">
|
|
981
|
+
<p-chart type="bar" [data]="data" [options]="options" class="h-[30rem]" />
|
|
982
|
+
</div>
|
|
983
|
+
`,
|
|
984
|
+
standalone: true,
|
|
985
|
+
imports: [ChartModule]
|
|
986
|
+
})
|
|
987
|
+
export class ChartStackedbarDemo implements OnInit {
|
|
988
|
+
data: any;
|
|
989
|
+
options: any;
|
|
990
|
+
platformId = inject(PLATFORM_ID);
|
|
991
|
+
configService = inject(AppConfigService);
|
|
992
|
+
|
|
993
|
+
ngOnInit() {
|
|
994
|
+
this.initChart();
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
initChart() {
|
|
998
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
999
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
1000
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
1001
|
+
const textColorSecondary = documentStyle.getPropertyValue('--p-text-muted-color');
|
|
1002
|
+
const surfaceBorder = documentStyle.getPropertyValue('--p-content-border-color');
|
|
1003
|
+
|
|
1004
|
+
this.data = {
|
|
1005
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
1006
|
+
datasets: [
|
|
1007
|
+
{
|
|
1008
|
+
type: 'bar',
|
|
1009
|
+
label: 'Dataset 1',
|
|
1010
|
+
backgroundColor: documentStyle.getPropertyValue('--p-cyan-500'),
|
|
1011
|
+
data: [50, 25, 12, 48, 90, 76, 42]
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
type: 'bar',
|
|
1015
|
+
label: 'Dataset 2',
|
|
1016
|
+
backgroundColor: documentStyle.getPropertyValue('--p-gray-500'),
|
|
1017
|
+
data: [21, 84, 24, 75, 37, 65, 34]
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
type: 'bar',
|
|
1021
|
+
label: 'Dataset 3',
|
|
1022
|
+
backgroundColor: documentStyle.getPropertyValue('--p-orange-500'),
|
|
1023
|
+
data: [41, 52, 24, 74, 23, 21, 32]
|
|
1024
|
+
}
|
|
1025
|
+
]
|
|
1026
|
+
};
|
|
1027
|
+
|
|
1028
|
+
this.options = {
|
|
1029
|
+
maintainAspectRatio: false,
|
|
1030
|
+
aspectRatio: 0.8,
|
|
1031
|
+
plugins: {
|
|
1032
|
+
tooltip: {
|
|
1033
|
+
mode: 'index',
|
|
1034
|
+
intersect: false
|
|
1035
|
+
},
|
|
1036
|
+
legend: {
|
|
1037
|
+
labels: {
|
|
1038
|
+
color: textColor
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
scales: {
|
|
1043
|
+
x: {
|
|
1044
|
+
stacked: true,
|
|
1045
|
+
ticks: {
|
|
1046
|
+
color: textColorSecondary
|
|
1047
|
+
},
|
|
1048
|
+
grid: {
|
|
1049
|
+
color: surfaceBorder,
|
|
1050
|
+
drawBorder: false
|
|
1051
|
+
}
|
|
1052
|
+
},
|
|
1053
|
+
y: {
|
|
1054
|
+
stacked: true,
|
|
1055
|
+
ticks: {
|
|
1056
|
+
color: textColorSecondary
|
|
1057
|
+
},
|
|
1058
|
+
grid: {
|
|
1059
|
+
color: surfaceBorder,
|
|
1060
|
+
drawBorder: false
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
this.cd.markForCheck();
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
## Vertical Bar
|
|
1072
|
+
|
|
1073
|
+
A bar chart or bar graph is a chart that presents grouped data with rectangular bars with lengths proportional to the values that they represent.
|
|
1074
|
+
|
|
1075
|
+
```typescript
|
|
1076
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
1077
|
+
import { ChartModule } from '@exhaustive-ui/core/chart';
|
|
1078
|
+
|
|
1079
|
+
@Component({
|
|
1080
|
+
template: `
|
|
1081
|
+
<div class="card">
|
|
1082
|
+
<p-chart type="bar" [data]="data" [options]="options" class="h-[30rem]" />
|
|
1083
|
+
</div>
|
|
1084
|
+
`,
|
|
1085
|
+
standalone: true,
|
|
1086
|
+
imports: [ChartModule]
|
|
1087
|
+
})
|
|
1088
|
+
export class ChartVerticalbarDemo implements OnInit {
|
|
1089
|
+
data: any;
|
|
1090
|
+
options: any;
|
|
1091
|
+
platformId = inject(PLATFORM_ID);
|
|
1092
|
+
configService = inject(AppConfigService);
|
|
1093
|
+
|
|
1094
|
+
ngOnInit() {
|
|
1095
|
+
this.initChart();
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
initChart() {
|
|
1099
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
1100
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
1101
|
+
const textColor = documentStyle.getPropertyValue('--p-text-color');
|
|
1102
|
+
const textColorSecondary = documentStyle.getPropertyValue('--p-text-muted-color');
|
|
1103
|
+
const surfaceBorder = documentStyle.getPropertyValue('--p-content-border-color');
|
|
1104
|
+
|
|
1105
|
+
this.data = {
|
|
1106
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
1107
|
+
datasets: [
|
|
1108
|
+
{
|
|
1109
|
+
label: 'My First dataset',
|
|
1110
|
+
backgroundColor: documentStyle.getPropertyValue('--p-cyan-500'),
|
|
1111
|
+
borderColor: documentStyle.getPropertyValue('--p-cyan-500'),
|
|
1112
|
+
data: [65, 59, 80, 81, 56, 55, 40]
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
label: 'My Second dataset',
|
|
1116
|
+
backgroundColor: documentStyle.getPropertyValue('--p-gray-500'),
|
|
1117
|
+
borderColor: documentStyle.getPropertyValue('--p-gray-500'),
|
|
1118
|
+
data: [28, 48, 40, 19, 86, 27, 90]
|
|
1119
|
+
}
|
|
1120
|
+
]
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
this.options = {
|
|
1124
|
+
maintainAspectRatio: false,
|
|
1125
|
+
aspectRatio: 0.8,
|
|
1126
|
+
plugins: {
|
|
1127
|
+
legend: {
|
|
1128
|
+
labels: {
|
|
1129
|
+
color: textColor
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
},
|
|
1133
|
+
scales: {
|
|
1134
|
+
x: {
|
|
1135
|
+
ticks: {
|
|
1136
|
+
color: textColorSecondary,
|
|
1137
|
+
font: {
|
|
1138
|
+
weight: 500
|
|
1139
|
+
}
|
|
1140
|
+
},
|
|
1141
|
+
grid: {
|
|
1142
|
+
color: surfaceBorder,
|
|
1143
|
+
drawBorder: false
|
|
1144
|
+
}
|
|
1145
|
+
},
|
|
1146
|
+
y: {
|
|
1147
|
+
ticks: {
|
|
1148
|
+
color: textColorSecondary
|
|
1149
|
+
},
|
|
1150
|
+
grid: {
|
|
1151
|
+
color: surfaceBorder,
|
|
1152
|
+
drawBorder: false
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
this.cd.markForCheck();
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
```
|
|
1162
|
+
|
|
1163
|
+
## Pass Through Options
|
|
1164
|
+
|
|
1165
|
+
| Name | Type | Description |
|
|
1166
|
+
|------|------|-------------|
|
|
1167
|
+
| host | PassThroughOption<HTMLElement, I> | Used to pass attributes to the host's DOM element. |
|
|
1168
|
+
| root | PassThroughOption<HTMLElement, I> | Used to pass attributes to the root's DOM element. |
|
|
1169
|
+
| canvas | PassThroughOption<HTMLCanvasElement, I> | Used to pass attributes to the canvas DOM element. |
|
|
1170
|
+
|
|
1171
|
+
## Theming
|
|
1172
|
+
|
|
1173
|
+
### CSS Classes
|
|
1174
|
+
|
|
1175
|
+
| Class | Description |
|
|
1176
|
+
|-------|-------------|
|
|
1177
|
+
| p-chart | Class name of the root element |
|
|
1178
|
+
|