Skip to content

Commit

Permalink
feat: upgrade to Angular 17 (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
xieziyu committed Nov 9, 2023
1 parent 02cf8c7 commit 33e7a1a
Show file tree
Hide file tree
Showing 18 changed files with 3,326 additions and 1,541 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Angular directive for [Apache ECharts (incubating)](https://github.com/apache/in

Latest version @npm:

- `v17.0.0` for Angular 17
- `v16.1.1` for Angular 16
- `v15.0.3` for Angular 15
- `v14.0.0` for Angular 14
Expand All @@ -55,6 +56,10 @@ A starter project on Github: https://github.com/xieziyu/ngx-echarts-starter

# Latest Update

- 2023.11.08: v17.0.0:

- Feat: upgrade to Angular 17

- 2023.10.11: v16.1.0:

- Feat: Add types to `chartXXX` EventEmitters. Support new events such as: `'selectchanged'`
Expand Down
9 changes: 5 additions & 4 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"schematics": {
"@schematics/angular:component": {
"style": "scss",
"skipTests": true
"skipTests": true,
"standalone": false
},
"@schematics/angular:service": {
"skipTests": true
Expand Down Expand Up @@ -98,18 +99,18 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ngx-echarts-demo:build"
"buildTarget": "ngx-echarts-demo:build"
},
"configurations": {
"production": {
"browserTarget": "ngx-echarts-demo:build:production"
"buildTarget": "ngx-echarts-demo:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ngx-echarts-demo:build"
"buildTarget": "ngx-echarts-demo:build"
}
},
"test": {
Expand Down
56 changes: 28 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-echarts-demo",
"version": "16.0.0",
"version": "17.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --port=4202",
Expand All @@ -24,42 +24,42 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~16.0.0",
"@angular/common": "~16.0.0",
"@angular/compiler": "~16.0.0",
"@angular/core": "~16.0.0",
"@angular/forms": "~16.0.0",
"@angular/platform-browser": "~16.0.0",
"@angular/platform-browser-dynamic": "~16.0.0",
"@angular/router": "~16.0.0",
"@angular/animations": "~17.0.1",
"@angular/common": "~17.0.1",
"@angular/compiler": "~17.0.1",
"@angular/core": "~17.0.1",
"@angular/forms": "~17.0.1",
"@angular/platform-browser": "~17.0.1",
"@angular/platform-browser-dynamic": "~17.0.1",
"@angular/router": "~17.0.1",
"@ant-design/icons-angular": "^13.1.0",
"echarts": "^5.4.2",
"echarts-gl": "^2.0.9",
"ng-zorro-antd": "~13.3.1",
"ng-zorro-antd": "~16.2.2",
"rxjs": "~7.5.5",
"tslib": "~2.4.0",
"zone.js": "~0.13.0"
"zone.js": "~0.14.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~16.0.0",
"@angular-devkit/core": "~16.0.0",
"@angular-eslint/builder": "^16.0.1",
"@angular-eslint/eslint-plugin": "^16.0.1",
"@angular-eslint/eslint-plugin-template": "^16.0.1",
"@angular-eslint/schematics": "^16.0.1",
"@angular-eslint/template-parser": "^16.0.1",
"@angular/cli": "~16.0.0",
"@angular/compiler-cli": "~16.0.0",
"@angular/language-service": "~16.0.0",
"@angular-devkit/build-angular": "~17.0.0",
"@angular-devkit/core": "~17.0.0",
"@angular-eslint/builder": "^17.0.0",
"@angular-eslint/eslint-plugin": "^17.0.0",
"@angular-eslint/eslint-plugin-template": "^17.0.0",
"@angular-eslint/schematics": "^17.0.0",
"@angular-eslint/template-parser": "^17.0.0",
"@angular/cli": "~17.0.0",
"@angular/compiler-cli": "~17.0.1",
"@angular/language-service": "~17.0.1",
"@compodoc/compodoc": "^1.1.19",
"@types/jasmine": "~4.0.3",
"@types/jasminewd2": "~2.0.10",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"codelyzer": "^6.0.2",
"cpr": "^3.0.1",
"eslint": "^8.40.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"html-loader": "^3.1.2",
Expand All @@ -70,15 +70,15 @@
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.0.0",
"ng-packagr": "^16.0.0",
"ngx-markdown": "^14.0.0",
"ng-packagr": "^17.0.0",
"ngx-markdown": "^16.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"prettier-eslint": "^15.0.1",
"prismjs": "^1.28.0",
"protractor": "~7.0.0",
"raw-loader": "^4.0.2",
"ts-node": "~10.8.1",
"typescript": "~5.0.4"
"typescript": "~5.2.2"
}
}
}
2 changes: 1 addition & 1 deletion projects/ngx-echarts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-echarts",
"version": "16.1.1",
"version": "17.0.0",
"author": "Xie, Ziyu",
"license": "MIT",
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ a.github-logo {

nz-content {
margin: 24px;
overflow-y: scroll;
}

.inner-content {
Expand Down
4 changes: 4 additions & 0 deletions src/app/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export const APP_MENUS: AppMenu[] = [
path: '/series/tree',
text: 'Tree',
},
{
path: '/series/heatmap',
text: 'Heatmap',
},
],
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/app/pages/demo-series/demo-series-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SeriesGraphComponent } from './series-graph/series-graph.component';
import { SeriesTreeComponent } from './series-tree/series-tree.component';
import { SeriesHeatmapComponent } from './series-heatmap/series-heatmap.component';

const routes: Routes = [
{ path: '', redirectTo: 'graph', pathMatch: 'full' },
{ path: 'graph', component: SeriesGraphComponent },
{ path: 'tree', component: SeriesTreeComponent },
{ path: 'heatmap', component: SeriesHeatmapComponent },
];

@NgModule({
Expand Down
6 changes: 6 additions & 0 deletions src/app/pages/demo-series/demo-series.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { GraphSimpleComponent } from './series-graph/graph-simple/graph-simple.c
import { SeriesTreeComponent } from './series-tree/series-tree.component';
import { TreeFromLeftToRightComponent } from './series-tree/tree-from-left-to-right/tree-from-left-to-right.component';
import { TreeRadialComponent } from './series-tree/tree-radial/tree-radial.component';
import { SeriesHeatmapComponent } from './series-heatmap/series-heatmap.component';
import { HeatmapCalendarComponent } from './series-heatmap/heatmap-calendar/heatmap-calendar.component';
import { HeatmapDiscreteComponent } from './series-heatmap/heatmap-discrete/heatmap-discrete.component';

@NgModule({
declarations: [
Expand All @@ -18,6 +21,9 @@ import { TreeRadialComponent } from './series-tree/tree-radial/tree-radial.compo
SeriesTreeComponent,
TreeFromLeftToRightComponent,
TreeRadialComponent,
SeriesHeatmapComponent,
HeatmapCalendarComponent,
HeatmapDiscreteComponent,
],
imports: [CommonModule, SharedModule, NgxEchartsModule, DemoSeriesRoutingModule],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- DEMO START -->
<div echarts [options]="options" class="demo-chart"></div>
<!-- DEMO END -->

<app-code-block [html]="html" [component]="component"> </app-code-block>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Component, OnInit } from '@angular/core';
import * as echarts from 'echarts';
import type { EChartsOption } from 'echarts';
// IGNORE START
declare const require: any;
// IGNORE END

@Component({
selector: 'app-heatmap-calendar',
templateUrl: './heatmap-calendar.component.html',
styleUrl: './heatmap-calendar.component.scss',
})
export class HeatmapCalendarComponent implements OnInit {
// IGNORE START
html =
require('!!html-loader?{"minimize": {"removeComments":false,"caseSensitive":true}}!./heatmap-calendar.component.html')
.default;
component = require('!!raw-loader!./heatmap-calendar.component.ts').default;
// IGNORE END
options: EChartsOption;

ngOnInit(): void {
this.options = {
title: {
top: 30,
left: 'center',
text: 'Daily Step Count',
},
tooltip: {},
visualMap: {
min: 0,
max: 10000,
type: 'piecewise',
orient: 'horizontal',
left: 'center',
top: 65,
},
calendar: {
top: 120,
left: 30,
right: 30,
cellSize: ['auto', 13],
range: '2016',
itemStyle: {
borderWidth: 0.5,
},
yearLabel: { show: false },
},
series: {
type: 'heatmap',
coordinateSystem: 'calendar',
data: this.getVirtualData('2016'),
},
};
}

getVirtualData(year: string) {
const date = +echarts.time.parse(year + '-01-01');
const end = +echarts.time.parse(+year + 1 + '-01-01');
const dayTime = 3600 * 24 * 1000;
const data: [string, number][] = [];
for (let time = date; time < end; time += dayTime) {
data.push([
echarts.time.format(time, '{yyyy}-{MM}-{dd}', false),
Math.floor(Math.random() * 10000),
]);
}
return data;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- DEMO START -->
<div echarts [options]="options" class="demo-chart"></div>
<!-- DEMO END -->

<app-code-block [html]="html" [component]="component"> </app-code-block>
Empty file.
Loading

0 comments on commit 33e7a1a

Please sign in to comment.