@codeauradev/ngx-wind-charts 0.0.0-stage → 1.0.0
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 +21 -0
- package/README.md +178 -2
- package/fesm2022/codeauradev-ngx-wind-charts-map.mjs +60292 -0
- package/fesm2022/codeauradev-ngx-wind-charts-map.mjs.map +1 -0
- package/fesm2022/codeauradev-ngx-wind-charts.mjs +3902 -0
- package/fesm2022/codeauradev-ngx-wind-charts.mjs.map +1 -0
- package/ngx-charts.css +281 -0
- package/package.json +52 -4
- package/types/codeauradev-ngx-wind-charts-map.d.ts +261 -0
- package/types/codeauradev-ngx-wind-charts.d.ts +969 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CodeAura contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,179 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @codeauradev/ngx-wind-charts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular 22 charts styled with Tailwind CSS. Pass data in. The components draw SVG.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { Component } from '@angular/core';
|
|
7
|
+
import { NgxBarChart, type CategoryDatum } from '@codeauradev/ngx-wind-charts';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'app-revenue',
|
|
11
|
+
imports: [NgxBarChart],
|
|
12
|
+
template: `
|
|
13
|
+
<ngx-bar-chart
|
|
14
|
+
[data]="revenue"
|
|
15
|
+
[height]="320"
|
|
16
|
+
format="currency"
|
|
17
|
+
title="Quarterly revenue"
|
|
18
|
+
ariaLabel="Quarterly revenue"
|
|
19
|
+
/>
|
|
20
|
+
`,
|
|
21
|
+
})
|
|
22
|
+
export class RevenueChart {
|
|
23
|
+
revenue: CategoryDatum[] = [
|
|
24
|
+
{ label: 'Q1', value: 128400 },
|
|
25
|
+
{ label: 'Q2', value: 146200 },
|
|
26
|
+
{ label: 'Q3', value: 139800 },
|
|
27
|
+
{ label: 'Q4', value: 172450 },
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @codeauradev/ngx-wind-charts
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Peer dependency: `@angular/core` `^22.0.0`. Tailwind CSS `^4` is optional. Without it, the shipped stylesheet still paints the series, grid, legend, and tooltip. With it, the templates pick up your theme.
|
|
39
|
+
|
|
40
|
+
Add both to the global stylesheet, Tailwind first:
|
|
41
|
+
|
|
42
|
+
```css
|
|
43
|
+
@import "tailwindcss";
|
|
44
|
+
@source "../node_modules/@codeauradev/ngx-wind-charts";
|
|
45
|
+
@import "@codeauradev/ngx-wind-charts/styles.css";
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`@source` lets Tailwind see the utility classes inside the package. The chart stylesheet maps series colors onto Tailwind tokens (`--color-sky-600`, `--color-amber-600`, and the rest) and falls back when those tokens are missing.
|
|
49
|
+
|
|
50
|
+
Override a series by setting these on any ancestor, or pass a `colors` array:
|
|
51
|
+
|
|
52
|
+
```css
|
|
53
|
+
.ngx-wind-charts {
|
|
54
|
+
--ngx-1: var(--color-sky-600);
|
|
55
|
+
--ngx-2: var(--color-amber-600);
|
|
56
|
+
--ngx-3: var(--color-emerald-600);
|
|
57
|
+
--ngx-4: var(--color-rose-600);
|
|
58
|
+
--ngx-5: var(--color-violet-600);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Charts
|
|
63
|
+
|
|
64
|
+
| Selector | Data | Notes |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
| `ngx-bar-chart` | `[data]` or `[series]` + `[categories]` | `mode` is `grouped` or `stacked`. `orientation` is `vertical` or `horizontal`. |
|
|
67
|
+
| `ngx-line-chart` | `[data]` or `[series]` + `[categories]` | One point per category. |
|
|
68
|
+
| `ngx-area-chart` | same as line | `[stacked]="true"` stacks the series. |
|
|
69
|
+
| `ngx-pie-chart` | `[data]` | Category rows. Zero and negative values are skipped. |
|
|
70
|
+
| `ngx-donut-chart` | `[data]` | Same component as pie, drawn as a ring. `[donut]="true"` on `ngx-pie-chart` does the same. |
|
|
71
|
+
| `ngx-radar-chart` | `[series]` + `[categories]` | Needs at least three axes. |
|
|
72
|
+
| `ngx-scatter-chart` | `[series]` of `{ x, y, label? }` | Both axes scale to the data. |
|
|
73
|
+
| `ngx-gauge-chart` | `[value]`, `[min]`, `[max]` | Arc from the minimum to the maximum. |
|
|
74
|
+
| `ngx-sparkline` | `[data]` of numbers | Compact line for a table cell or stat. |
|
|
75
|
+
| `ngx-heatmap` | `[xLabels]`, `[yLabels]`, `[data]` | `data[row][column]`. |
|
|
76
|
+
| `ngx-usa-map` | `[states]`, `[counties]`, `[cities]` | USA choropleth. Click a state, then a county, to drill down. |
|
|
77
|
+
|
|
78
|
+
Every chart takes `title`, `height`, `ariaLabel`, `format`, `currency`, and `colors`. Category charts also take `showLegend`, `showGrid`, and `animate`.
|
|
79
|
+
|
|
80
|
+
`format` is `'number'`, `'compact'`, `'percent'`, `'currency'`, or a function `(value: number) => string`. `percent` prints the number as a percent (`42` becomes `42%`). It does not treat `0.42` as 42%. `currency` uses `currency`, which defaults to `USD`.
|
|
81
|
+
|
|
82
|
+
## Passing series
|
|
83
|
+
|
|
84
|
+
`data` is the short form: one value per category.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
data: CategoryDatum[] = [
|
|
88
|
+
{ label: 'Organic', value: 42 },
|
|
89
|
+
{ label: 'Direct', value: 23, color: 'var(--ngx-2)' },
|
|
90
|
+
];
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`series` is the long form. Each series lines up with `categories` by index.
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
categories = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'];
|
|
97
|
+
series: ChartSeries[] = [
|
|
98
|
+
{ name: 'Committed', data: [28, 32, 30, 26, 34] },
|
|
99
|
+
{ name: 'Done', data: [24, 30, 29, 27, 33] },
|
|
100
|
+
];
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<ngx-bar-chart
|
|
105
|
+
[categories]="categories"
|
|
106
|
+
[series]="series"
|
|
107
|
+
mode="grouped"
|
|
108
|
+
[showValues]="true"
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Scatter series use points instead of a number list:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
campaigns = [
|
|
116
|
+
{
|
|
117
|
+
name: 'Search',
|
|
118
|
+
data: [
|
|
119
|
+
{ x: 1200, y: 48, label: 'Brand' },
|
|
120
|
+
{ x: 2400, y: 81, label: 'Generic' },
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
];
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```html
|
|
127
|
+
<ngx-scatter-chart [series]="campaigns" format="compact" />
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Heatmap rows follow `yLabels`. Columns follow `xLabels`.
|
|
131
|
+
|
|
132
|
+
```html
|
|
133
|
+
<ngx-heatmap [xLabels]="hours" [yLabels]="days" [data]="tickets" title="Support load" />
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`ngx-usa-map` is a choropleth of the United States. `states`, `counties`, and `cities` each take `{ id, value }`. A state id can be a FIPS code, a postal abbreviation, or the state name. A county id can be a five-digit FIPS code or `Name, ST`. A city id is `Name, ST`, matching the built-in places. Click a state to open its counties, then a county to plot the cities in that county. Set `[drill]="false"` to keep the national view.
|
|
137
|
+
|
|
138
|
+
```html
|
|
139
|
+
<ngx-usa-map
|
|
140
|
+
[states]="states"
|
|
141
|
+
[counties]="counties"
|
|
142
|
+
[cities]="cities"
|
|
143
|
+
legend="Index"
|
|
144
|
+
title="United States"
|
|
145
|
+
/>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
states = [
|
|
150
|
+
{ id: 'CA', value: 72 },
|
|
151
|
+
{ id: 'TX', value: 64 },
|
|
152
|
+
{ id: 'NY', value: 81 },
|
|
153
|
+
];
|
|
154
|
+
counties = [{ id: '06037', value: 88 }];
|
|
155
|
+
cities = [{ id: 'Los Angeles, CA', value: 91 }];
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The gradient uses `--ngx-map-min` and `--ngx-map-max`. Regions with no value stay on `--ngx-map-empty`. Hovering moves the legend marker, the same idea as a banded choropleth scale.
|
|
159
|
+
|
|
160
|
+
## Behavior
|
|
161
|
+
|
|
162
|
+
- Charts measure their host and redraw when it changes size.
|
|
163
|
+
- Hover a mark for a tooltip. A visually hidden table carries the same numbers for assistive tech.
|
|
164
|
+
- The SVG is decorative. `ariaLabel` names the figure.
|
|
165
|
+
- Empty input renders a short empty state instead of a broken scale.
|
|
166
|
+
- Bar charts include zero, so negative values grow away from the baseline. Stacked bars stack positives upward and negatives downward.
|
|
167
|
+
- Line charts scale to the data. Area charts include zero.
|
|
168
|
+
- Motion fades marks in. `prefers-reduced-motion` turns that off. Set `[animate]="false"` to skip it.
|
|
169
|
+
- Colors are CSS variables, so a Tailwind dark theme that changes `--color-sky-600` (or `--ngx-1`) restyles the series without a new data pass.
|
|
170
|
+
|
|
171
|
+
## Build this package
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
npm install
|
|
175
|
+
npm test
|
|
176
|
+
npm run build
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Publish the `dist/` folder. It is an Angular Package Format build (partial compilation) for the application linker. `dist/ngx-charts.css` is the stylesheet, exported as `@codeauradev/ngx-wind-charts/styles.css`. The class `.ngx-charts` still matches `.ngx-wind-charts`.
|