Skip to content

Commit 051d44c

Browse files
committed
feat: release
1 parent cf0d3f3 commit 051d44c

File tree

14 files changed

+127
-114
lines changed

14 files changed

+127
-114
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This is a small chart library for Angular based on D3js. It currently supports single line and multi line charts with a legend. Bar and Donut charts are now supported too. The token service and token interceptor are now included in a configurable manner. The Bar charts, line charts, donut, and Date/Timeline charts and the services are in separate entry points to enable the Angular Compiler to put only the required code in the modules that use the features. Its purpose is to enable fast updates to new Angular versions. To enable the fast updates and due to limited time the library will continue have a small feature set.
44

55
## Minimum Supported Angular Version
6-
Angular 18
6+
Angular 19
77

88
[![CodeQL](https://github.com/Angular2Guy/ngx-simple-charts/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Angular2Guy/ngx-simple-charts/actions/workflows/codeql-analysis.yml)
99

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-simple-charts",
3-
"version": "19.0.0-beta.1",
3+
"version": "19.0.0",
44
"license": "Apache License Version 2.0",
55
"scripts": {
66
"ng": "ng",

projects/ngx-simple-charts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This is a small chart library for Angular based on D3js. It currently supports single line and multi line charts with a legend. Bar and Donut charts are now supported too. The token service and token interceptor are now included in a configurable manner. The Bar charts, line charts, donut, and Date/Timeline charts and the services are in separate entry points to enable the Angular Compiler to put only the required code in the modules that use the features. Its purpose is to enable fast updates to new Angular versions. To enable the fast updates and due to limited time the library will continue have a small feature set.
44

55
## Minimum Supported Angular Version
6-
Angular 18
6+
Angular 19
77

88
[![CodeQL](https://github.com/Angular2Guy/ngx-simple-charts/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Angular2Guy/ngx-simple-charts/actions/workflows/codeql-analysis.yml)
99

projects/ngx-simple-charts/bar/src/lib/sc-bar-chart/sc-bar-chart.component.ts

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ class Tuple<A, B> {
5959
}
6060

6161
@Component({
62-
selector: 'sc-bar-chart',
63-
templateUrl: './sc-bar-chart.component.html',
64-
styleUrls: ['./sc-bar-chart.component.scss'],
65-
standalone: false
62+
selector: 'sc-bar-chart',
63+
templateUrl: './sc-bar-chart.component.html',
64+
styleUrls: ['./sc-bar-chart.component.scss'],
65+
standalone: false,
6666
})
6767
export class ScBarChartComponent
6868
implements AfterViewInit, OnChanges, OnDestroy
@@ -88,7 +88,7 @@ export class ScBarChartComponent
8888

8989
ngAfterViewInit(): void {
9090
this.d3Svg = select<ContainerElement, ChartBar>(
91-
this.chartContainer.nativeElement
91+
this.chartContainer.nativeElement,
9292
);
9393

9494
this.chartUpdateSubscription = this.chartUpdateSubject
@@ -105,26 +105,26 @@ export class ScBarChartComponent
105105
private calcBarChartsXScalePosition(
106106
contentHeight: number,
107107
minYValue: number,
108-
maxYValue: number
108+
maxYValue: number,
109109
): Tuple<YScalePosition, number> {
110110
const positivePart =
111111
maxYValue / (Math.abs(minYValue) + Math.abs(maxYValue));
112112
let xPosition =
113113
minYValue >= 0 && maxYValue >= 0
114114
? new Tuple<YScalePosition, number>(
115115
YScalePosition.Bottom,
116-
contentHeight - this.chartBars.xScaleHeight
116+
contentHeight - this.chartBars.xScaleHeight,
117117
)
118118
: new Tuple<YScalePosition, number>(
119119
YScalePosition.Middle,
120-
(contentHeight - this.chartBars.xScaleHeight) * positivePart
120+
(contentHeight - this.chartBars.xScaleHeight) * positivePart,
121121
);
122122
//console.log(xPosition);
123123
xPosition =
124124
minYValue <= 0 && maxYValue <= 0
125125
? new Tuple<YScalePosition, number>(
126126
YScalePosition.Top,
127-
this.chartBars.xScaleHeight
127+
this.chartBars.xScaleHeight,
128128
)
129129
: xPosition;
130130
//console.log(xPosition);
@@ -133,12 +133,12 @@ export class ScBarChartComponent
133133

134134
private updateChart(): void {
135135
const contentWidth = isNaN(
136-
parseInt(this.d3Svg.style('width').replace(/[^0-9\.]+/g, ''), 10)
136+
parseInt(this.d3Svg.style('width').replace(/[^0-9\.]+/g, ''), 10),
137137
)
138138
? 0
139139
: parseInt(this.d3Svg.style('width').replace(/[^0-9\.]+/g, ''), 10);
140140
const contentHeight = isNaN(
141-
parseInt(this.d3Svg.style('height').replace(/[^0-9\.]+/g, ''), 10)
141+
parseInt(this.d3Svg.style('height').replace(/[^0-9\.]+/g, ''), 10),
142142
)
143143
? 0
144144
: parseInt(this.d3Svg.style('height').replace(/[^0-9\.]+/g, ''), 10);
@@ -167,7 +167,7 @@ export class ScBarChartComponent
167167
const yScalePositionY = this.calcBarChartsXScalePosition(
168168
contentHeight,
169169
minYValue,
170-
maxYValue
170+
maxYValue,
171171
);
172172

173173
// Add Y axis
@@ -184,46 +184,50 @@ export class ScBarChartComponent
184184
(yScalePositionY.a === YScalePosition.Top
185185
? '' + this.chartBars.xScaleHeight
186186
: '' + 0) +
187-
')'
187+
')',
188188
)
189189
.call(
190190
axisLeft(yScale as unknown as AxisScale<number>) as (
191191
selection: Selection<SVGGElement, ChartBar, HTMLElement, any>,
192192
...args: any[]
193-
) => void
193+
) => void,
194194
);
195195

196196
const yScalePosition = this.calcBarChartsXScalePosition(
197197
contentHeight,
198198
min(yScale.domain()) || 0,
199-
max(yScale.domain()) || 0
199+
max(yScale.domain()) || 0,
200200
);
201201

202202
gxAttribute
203203
.attr(
204204
'transform',
205-
'translate(' + this.chartBars.yScaleWidth + ',' + yScalePosition.b + ')'
205+
'translate(' +
206+
this.chartBars.yScaleWidth +
207+
',' +
208+
yScalePosition.b +
209+
')',
206210
)
207211
.call(
208212
axisBottom(xScale as unknown as AxisScale<number>) as (
209213
selection: Selection<SVGGElement, ChartBar, HTMLElement, any>,
210214
...args: any[]
211-
) => void
215+
) => void,
212216
)
213217
.selectAll('text')
214218
.attr(
215219
'transform',
216220
yScalePosition.a === YScalePosition.Top
217221
? 'translate(-10,-15)rotate(-45)'
218222
: yScalePosition.a === YScalePosition.Bottom
219-
? 'translate(-10,0)rotate(-45)'
220-
: `translate(-10,${
221-
contentHeight - yScalePosition.b - this.chartBars.xScaleHeight
222-
})rotate(-45)`
223+
? 'translate(-10,0)rotate(-45)'
224+
: `translate(-10,${
225+
contentHeight - yScalePosition.b - this.chartBars.xScaleHeight
226+
})rotate(-45)`,
223227
)
224228
.style(
225229
'text-anchor',
226-
yScalePosition.a === YScalePosition.Top ? 'start' : 'end'
230+
yScalePosition.a === YScalePosition.Top ? 'start' : 'end',
227231
);
228232

229233
//console.log(yScale.domain());
@@ -243,7 +247,7 @@ export class ScBarChartComponent
243247
.join('rect')
244248
.attr(
245249
'x',
246-
(d) => (xScale(d.x) as unknown as number) + this.chartBars.yScaleWidth
250+
(d) => (xScale(d.x) as unknown as number) + this.chartBars.yScaleWidth,
247251
)
248252
.attr('width', xScale.bandwidth())
249253
.attr('height', 0)
@@ -253,8 +257,8 @@ export class ScBarChartComponent
253257
yScalePosition.a === YScalePosition.Top
254258
? this.chartBars.xScaleHeight
255259
: yScalePosition.a === YScalePosition.Bottom || d.y > 0
256-
? yScale(d.y)
257-
: yScalePosition.b
260+
? yScale(d.y)
261+
: yScalePosition.b,
258262
)
259263
.attr('height', (d) => {
260264
let result = 0;
@@ -275,7 +279,7 @@ export class ScBarChartComponent
275279
(d) =>
276280
'bar bar-' +
277281
d.x.split(/[^a-zA-Z0-9\-]/)[0].toLowerCase() +
278-
`${d.x === this.chartBars.title ? ' bar-portfolio' : ''}`
282+
`${d.x === this.chartBars.title ? ' bar-portfolio' : ''}`,
279283
)
280284
.delay((d, i) => i * 100);
281285
}

projects/ngx-simple-charts/base-service/src/lib/ngx-service.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { RouterModule } from '@angular/router';
2626
})
2727
export class NgxServiceModule {
2828
static forRoot(
29-
config: SimpleChartsConfig
29+
config: SimpleChartsConfig,
3030
): ModuleWithProviders<NgxServiceModule> {
3131
return {
3232
ngModule: NgxServiceModule,

projects/ngx-simple-charts/base-service/src/lib/sc-service/token.interceptor.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
limitations under the License.
1212
*/
1313
import { Injectable } from '@angular/core';
14-
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http';
14+
import {
15+
HttpInterceptor,
16+
HttpRequest,
17+
HttpHandler,
18+
HttpEvent,
19+
HttpErrorResponse,
20+
} from '@angular/common/http';
1521
import { Observable, of } from 'rxjs';
1622
import { tap } from 'rxjs/operators';
1723
import { TokenService } from './token.service';
@@ -22,16 +28,16 @@ export class TokenInterceptor implements HttpInterceptor {
2228

2329
intercept(
2430
req: HttpRequest<any>,
25-
next: HttpHandler
31+
next: HttpHandler,
2632
): Observable<HttpEvent<any>> {
2733
req = req.clone({
2834
headers: this.tokenService.createTokenHeader(),
2935
});
3036
return next.handle(req).pipe(
3137
tap(
3238
(event) => event,
33-
(event) => this.handleError(event)
34-
)
39+
(event) => this.handleError(event),
40+
),
3541
);
3642
}
3743

projects/ngx-simple-charts/base-service/src/lib/sc-service/token.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class TokenService {
4747
constructor(
4848
private http: HttpClient,
4949
private router: Router,
50-
@Inject(MODULE_CONFIG) private moduleConfig: SimpleChartsConfig
50+
@Inject(MODULE_CONFIG) private moduleConfig: SimpleChartsConfig,
5151
) {}
5252

5353
private refreshToken(): Observable<RefreshTokenResponse> {
@@ -116,11 +116,11 @@ export class TokenService {
116116
takeUntil(myStopTimer),
117117
switchMap(() => this.refreshToken()),
118118
retry({ count: 3, delay: 2000, resetOnSuccess: true }),
119-
shareReplay(this.CACHE_SIZE)
119+
shareReplay(this.CACHE_SIZE),
120120
);
121121
this.myTokenSubscription = this.myTokenCache.subscribe(
122122
(newToken) => (this.myToken = newToken.refreshToken),
123-
() => this.clear()
123+
() => this.clear(),
124124
);
125125
}
126126
}

projects/ngx-simple-charts/date-time/src/lib/sc-date-time-chart/sc-date-time-chart-base.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class ScDateTimeChartBase {
3939
.reduce(
4040
(acc, myItem) =>
4141
(myItem as Date).valueOf() < (acc as Date).valueOf() ? myItem : acc,
42-
new Date()
42+
new Date(),
4343
) as Date;
4444
//console.log(this.localStart);
4545
/*
@@ -68,8 +68,8 @@ export class ScDateTimeChartBase {
6868
openEndItems.length > 0 || !this.localShowDays
6969
? endOfYear
7070
: lastEndYear < 1
71-
? endOfYear
72-
: lastEndItem.end;
71+
? endOfYear
72+
: lastEndItem.end;
7373
this.periodDays = [];
7474
for (
7575
let myDay = DateTime.fromObject({
@@ -95,7 +95,7 @@ export class ScDateTimeChartBase {
9595
) {
9696
this.periodMonths.push(myMonth);
9797
this.monthHeaderAnchorIds.push(
98-
'M_' + this.generateHeaderAnchorId(myMonth)
98+
'M_' + this.generateHeaderAnchorId(myMonth),
9999
);
100100
}
101101
this.periodYears = [];

projects/ngx-simple-charts/date-time/src/lib/sc-date-time-chart/sc-date-time-chart.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
[id]="monthHeaderAnchorIds[indexOfElement]"
2525
[style.width.px]="periodMonth.daysInMonth * (DAY_WIDTH + 2) - 2"
2626
>
27-
{{ periodMonth.toJSDate() | date : "MMMM YYYY" }}
27+
{{ periodMonth.toJSDate() | date: "MMMM YYYY" }}
2828
</div>
2929
</div>
3030
<div class="header-line">
@@ -34,7 +34,7 @@
3434
[class.header-sunday]="periodDay.weekday === 7"
3535
[style.width.px]="DAY_WIDTH"
3636
>
37-
{{ periodDay.toJSDate() | date : "dd" }}
37+
{{ periodDay.toJSDate() | date: "dd" }}
3838
</div>
3939
</div>
4040
</ng-container>
@@ -55,7 +55,7 @@
5555
class="header-box"
5656
[style.width.px]="MONTH_WIDTH"
5757
>
58-
{{ periodMonth.toJSDate() | date : "MMMM" }}
58+
{{ periodMonth.toJSDate() | date: "MMMM" }}
5959
</div>
6060
</div>
6161
</ng-container>

projects/ngx-simple-charts/date-time/src/lib/sc-date-time-chart/sc-date-time-chart.component.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ interface LineKeyToItems {
3030
}
3131

3232
@Component({
33-
selector: 'sc-date-time-chart',
34-
templateUrl: './sc-date-time-chart.component.html',
35-
styleUrls: ['./sc-date-time-chart.component.scss'],
36-
standalone: false
33+
selector: 'sc-date-time-chart',
34+
templateUrl: './sc-date-time-chart.component.html',
35+
styleUrls: ['./sc-date-time-chart.component.scss'],
36+
standalone: false,
3737
})
3838
export class ScDateTimeChartComponent
3939
extends ScDateTimeChartBase
@@ -61,14 +61,14 @@ export class ScDateTimeChartComponent
6161
setTimeout(() => {
6262
let myPeriods = !this.showDays ? this.periodYears : this.periodMonths;
6363
myPeriods = myPeriods.filter(
64-
(myPeriod) => myPeriod.diffNow().seconds <= 0
64+
(myPeriod) => myPeriod.diffNow().seconds <= 0,
6565
);
6666
const myPeriodIndex = myPeriods.length === 0 ? -1 : myPeriods.length - 1;
6767
if (myPeriodIndex >= 0) {
6868
this.scrollToAnchorId(
6969
!this.showDays
7070
? this.yearHeaderAnchorIds[myPeriodIndex]
71-
: this.monthHeaderAnchorIds[myPeriodIndex]
71+
: this.monthHeaderAnchorIds[myPeriodIndex],
7272
);
7373
}
7474
this.calcTimeChartValues();
@@ -125,7 +125,7 @@ export class ScDateTimeChartComponent
125125
});
126126
const itemInterval = Interval.fromDateTimes(
127127
chartStart,
128-
!!start ? DateTime.fromJSDate(start) : chartStart
128+
!!start ? DateTime.fromJSDate(start) : chartStart,
129129
);
130130
const itemPeriods = !this.showDays
131131
? itemInterval.length('months')
@@ -139,7 +139,7 @@ export class ScDateTimeChartComponent
139139
const chartEnd = DateTime.fromJSDate(this.end);
140140
const itemInterval = Interval.fromDateTimes(
141141
DateTime.fromJSDate(end),
142-
chartEnd
142+
chartEnd,
143143
);
144144
const itemPeriods = !this.showDays
145145
? itemInterval.length('months')
@@ -188,8 +188,8 @@ export class ScDateTimeChartComponent
188188
this.anchoreIdIndex + timeDiff < 0
189189
? 0
190190
: this.anchoreIdIndex + timeDiff >= anchorIds.length
191-
? anchorIds.length - 1
192-
: this.anchoreIdIndex + timeDiff;
191+
? anchorIds.length - 1
192+
: this.anchoreIdIndex + timeDiff;
193193
this.scrollToAnchorId(anchorIds[this.anchoreIdIndex]);
194194
}
195195

0 commit comments

Comments
 (0)