@ojiepermana/angular-chart 22.0.44 → 22.0.46
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/fesm2022/ojiepermana-angular-chart-area.mjs +20 -11
- package/fesm2022/ojiepermana-angular-chart-bar.mjs +25 -14
- package/fesm2022/ojiepermana-angular-chart-core.mjs +3 -5
- package/fesm2022/ojiepermana-angular-chart-line.mjs +20 -11
- package/fesm2022/ojiepermana-angular-chart-pie.mjs +22 -11
- package/fesm2022/ojiepermana-angular-chart-primitives.mjs +111 -58
- package/fesm2022/ojiepermana-angular-chart-radar.mjs +56 -21
- package/fesm2022/ojiepermana-angular-chart-radial.mjs +22 -11
- package/fesm2022/ojiepermana-angular-chart-scatter.mjs +12 -7
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import { arc } from 'd3-shape';
|
|
|
2
2
|
import { max } from 'd3-array';
|
|
3
3
|
import { seriesColorVar, ChartContext, ChartThemeRadius } from '@ojiepermana/angular-chart/core';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { inject, input, output, computed,
|
|
5
|
+
import { inject, input, output, computed, Component } from '@angular/core';
|
|
6
6
|
|
|
7
7
|
function computeRadialLayout(input) {
|
|
8
8
|
const { data, nameKey, valueKey, innerWidth, innerHeight, seriesKeys, trackPadding, startAngle, endAngle, cornerRadius, } = input;
|
|
@@ -132,8 +132,12 @@ class RadialChart {
|
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
setActive(event, b) {
|
|
135
|
-
const clientX = event instanceof PointerEvent
|
|
136
|
-
|
|
135
|
+
const clientX = event instanceof PointerEvent
|
|
136
|
+
? event.clientX
|
|
137
|
+
: event.target.getBoundingClientRect().left;
|
|
138
|
+
const clientY = event instanceof PointerEvent
|
|
139
|
+
? event.clientY
|
|
140
|
+
: event.target.getBoundingClientRect().top;
|
|
137
141
|
this.root.activePoint.set({
|
|
138
142
|
index: b.datumIndex,
|
|
139
143
|
datumIndex: b.datumIndex,
|
|
@@ -152,7 +156,8 @@ class RadialChart {
|
|
|
152
156
|
[attr.viewBox]="viewBox()"
|
|
153
157
|
preserveAspectRatio="xMidYMid meet"
|
|
154
158
|
role="img"
|
|
155
|
-
[attr.aria-label]="ariaSummary()"
|
|
159
|
+
[attr.aria-label]="ariaSummary()"
|
|
160
|
+
>
|
|
156
161
|
<svg:g [attr.transform]="innerTransform()">
|
|
157
162
|
<svg:g [attr.transform]="'translate(' + layout().centerX + ',' + layout().centerY + ')'">
|
|
158
163
|
@for (b of layout().bars; track b.seriesKey) {
|
|
@@ -164,6 +169,7 @@ class RadialChart {
|
|
|
164
169
|
[attr.d]="b.arcPath"
|
|
165
170
|
[attr.fill]="b.color"
|
|
166
171
|
[attr.aria-label]="barAriaLabel(b)"
|
|
172
|
+
role="img"
|
|
167
173
|
tabindex="0"
|
|
168
174
|
(click)="emitClick(b)"
|
|
169
175
|
(keydown.enter)="emitClick(b)"
|
|
@@ -172,14 +178,16 @@ class RadialChart {
|
|
|
172
178
|
(pointermove)="setActive($event, b)"
|
|
173
179
|
(pointerleave)="clearActive()"
|
|
174
180
|
(focus)="setActive($event, b)"
|
|
175
|
-
(blur)="clearActive()"
|
|
181
|
+
(blur)="clearActive()"
|
|
182
|
+
/>
|
|
176
183
|
@if (showValueLabels()) {
|
|
177
184
|
<svg:text
|
|
178
185
|
class="chart-radial-value pointer-events-none fill-muted-foreground text-2xs"
|
|
179
186
|
[attr.x]="barLabelX(b)"
|
|
180
187
|
[attr.y]="barLabelY(b)"
|
|
181
188
|
[attr.text-anchor]="barLabelAnchor(b)"
|
|
182
|
-
dominant-baseline="middle"
|
|
189
|
+
dominant-baseline="middle"
|
|
190
|
+
>
|
|
183
191
|
{{ formatValueLabel(b) }}
|
|
184
192
|
</svg:text>
|
|
185
193
|
}
|
|
@@ -192,13 +200,12 @@ class RadialChart {
|
|
|
192
200
|
</div>
|
|
193
201
|
<ng-content select="ChartTooltip" />
|
|
194
202
|
<ng-content select="ChartLegend" />
|
|
195
|
-
`, isInline: true
|
|
203
|
+
`, isInline: true });
|
|
196
204
|
}
|
|
197
205
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: RadialChart, decorators: [{
|
|
198
206
|
type: Component,
|
|
199
207
|
args: [{
|
|
200
208
|
selector: 'ChartRadial',
|
|
201
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
202
209
|
host: { class: 'relative block h-full w-full', '[attr.data-style]': 'styles()' },
|
|
203
210
|
template: `
|
|
204
211
|
<svg:svg
|
|
@@ -206,7 +213,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
206
213
|
[attr.viewBox]="viewBox()"
|
|
207
214
|
preserveAspectRatio="xMidYMid meet"
|
|
208
215
|
role="img"
|
|
209
|
-
[attr.aria-label]="ariaSummary()"
|
|
216
|
+
[attr.aria-label]="ariaSummary()"
|
|
217
|
+
>
|
|
210
218
|
<svg:g [attr.transform]="innerTransform()">
|
|
211
219
|
<svg:g [attr.transform]="'translate(' + layout().centerX + ',' + layout().centerY + ')'">
|
|
212
220
|
@for (b of layout().bars; track b.seriesKey) {
|
|
@@ -218,6 +226,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
218
226
|
[attr.d]="b.arcPath"
|
|
219
227
|
[attr.fill]="b.color"
|
|
220
228
|
[attr.aria-label]="barAriaLabel(b)"
|
|
229
|
+
role="img"
|
|
221
230
|
tabindex="0"
|
|
222
231
|
(click)="emitClick(b)"
|
|
223
232
|
(keydown.enter)="emitClick(b)"
|
|
@@ -226,14 +235,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
226
235
|
(pointermove)="setActive($event, b)"
|
|
227
236
|
(pointerleave)="clearActive()"
|
|
228
237
|
(focus)="setActive($event, b)"
|
|
229
|
-
(blur)="clearActive()"
|
|
238
|
+
(blur)="clearActive()"
|
|
239
|
+
/>
|
|
230
240
|
@if (showValueLabels()) {
|
|
231
241
|
<svg:text
|
|
232
242
|
class="chart-radial-value pointer-events-none fill-muted-foreground text-2xs"
|
|
233
243
|
[attr.x]="barLabelX(b)"
|
|
234
244
|
[attr.y]="barLabelY(b)"
|
|
235
245
|
[attr.text-anchor]="barLabelAnchor(b)"
|
|
236
|
-
dominant-baseline="middle"
|
|
246
|
+
dominant-baseline="middle"
|
|
247
|
+
>
|
|
237
248
|
{{ formatValueLabel(b) }}
|
|
238
249
|
</svg:text>
|
|
239
250
|
}
|
|
@@ -2,7 +2,7 @@ import { scaleLinear } from 'd3-scale';
|
|
|
2
2
|
import { extent } from 'd3-array';
|
|
3
3
|
import { seriesColorVar, ChartContext, ScatterViewportContext } from '@ojiepermana/angular-chart/core';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { inject, input, output, computed, effect,
|
|
5
|
+
import { inject, input, output, computed, effect, Component } from '@angular/core';
|
|
6
6
|
|
|
7
7
|
function nice(extent) {
|
|
8
8
|
const [lo, hi] = extent;
|
|
@@ -172,7 +172,8 @@ class ScatterChart {
|
|
|
172
172
|
[attr.viewBox]="viewBox()"
|
|
173
173
|
preserveAspectRatio="none"
|
|
174
174
|
role="img"
|
|
175
|
-
[attr.aria-label]="ariaSummary()"
|
|
175
|
+
[attr.aria-label]="ariaSummary()"
|
|
176
|
+
>
|
|
176
177
|
<svg:defs>
|
|
177
178
|
<svg:clipPath [attr.id]="clipPathId()">
|
|
178
179
|
<svg:rect x="0" y="0" [attr.width]="innerWidth()" [attr.height]="innerHeight()" />
|
|
@@ -188,10 +189,12 @@ class ScatterChart {
|
|
|
188
189
|
[attr.r]="p.radius"
|
|
189
190
|
[attr.fill]="p.color"
|
|
190
191
|
[attr.aria-label]="pointAriaLabel(p)"
|
|
192
|
+
role="img"
|
|
191
193
|
tabindex="0"
|
|
192
194
|
(click)="emitClick(p)"
|
|
193
195
|
(keydown.enter)="emitClick(p)"
|
|
194
|
-
(keydown.space)="emitClick(p); $event.preventDefault()"
|
|
196
|
+
(keydown.space)="emitClick(p); $event.preventDefault()"
|
|
197
|
+
/>
|
|
195
198
|
}
|
|
196
199
|
</svg:g>
|
|
197
200
|
<ng-content select="svg:g[ChartBrush]" />
|
|
@@ -199,13 +202,12 @@ class ScatterChart {
|
|
|
199
202
|
</svg:svg>
|
|
200
203
|
<ng-content select="ChartLegend" />
|
|
201
204
|
<ng-content select="ChartZoomControls" />
|
|
202
|
-
`, isInline: true
|
|
205
|
+
`, isInline: true });
|
|
203
206
|
}
|
|
204
207
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: ScatterChart, decorators: [{
|
|
205
208
|
type: Component,
|
|
206
209
|
args: [{
|
|
207
210
|
selector: 'ChartScatter',
|
|
208
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
209
211
|
providers: [ScatterViewportContext],
|
|
210
212
|
host: { class: 'relative block h-full w-full', '[attr.data-style]': 'styles()' },
|
|
211
213
|
template: `
|
|
@@ -214,7 +216,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
214
216
|
[attr.viewBox]="viewBox()"
|
|
215
217
|
preserveAspectRatio="none"
|
|
216
218
|
role="img"
|
|
217
|
-
[attr.aria-label]="ariaSummary()"
|
|
219
|
+
[attr.aria-label]="ariaSummary()"
|
|
220
|
+
>
|
|
218
221
|
<svg:defs>
|
|
219
222
|
<svg:clipPath [attr.id]="clipPathId()">
|
|
220
223
|
<svg:rect x="0" y="0" [attr.width]="innerWidth()" [attr.height]="innerHeight()" />
|
|
@@ -230,10 +233,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
230
233
|
[attr.r]="p.radius"
|
|
231
234
|
[attr.fill]="p.color"
|
|
232
235
|
[attr.aria-label]="pointAriaLabel(p)"
|
|
236
|
+
role="img"
|
|
233
237
|
tabindex="0"
|
|
234
238
|
(click)="emitClick(p)"
|
|
235
239
|
(keydown.enter)="emitClick(p)"
|
|
236
|
-
(keydown.space)="emitClick(p); $event.preventDefault()"
|
|
240
|
+
(keydown.space)="emitClick(p); $event.preventDefault()"
|
|
241
|
+
/>
|
|
237
242
|
}
|
|
238
243
|
</svg:g>
|
|
239
244
|
<ng-content select="svg:g[ChartBrush]" />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ojiepermana/angular-chart",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.46",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/edsis/angular.git"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@angular/common": ">=22.0.0",
|
|
14
14
|
"@angular/core": ">=22.0.0",
|
|
15
|
-
"@ojiepermana/angular-component": "^22.0.
|
|
15
|
+
"@ojiepermana/angular-component": "^22.0.46"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"d3-array": "^3.2.4",
|