cats-charts 0.0.23 → 0.0.25

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/README.md CHANGED
@@ -1,59 +1,192 @@
1
1
  # CATS4U Charts
2
2
 
3
- This library was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.0 and it also usages [Apache Echarts](https://www.npmjs.com/package/echarts) for charts.
3
+ ![npm](https://img.shields.io/npm/v/cats-charts)
4
+ ![npm downloads](https://img.shields.io/npm/dm/cats-charts)
5
+ ![license](https://img.shields.io/npm/l/cats-charts)
6
+ ![angular](https://img.shields.io/badge/angular-20-red)
4
7
 
5
- ## Install
8
+ **CATS4U Charts** is a reusable Angular chart library built on **Apache ECharts** and **ngx-echarts**.
9
+ It provides easy-to-use components for rendering interactive charts such as **Bar, Line, Area, Pie, Doughnut, Sankey**, and more.
6
10
 
7
- ```
8
- npm install cats-charts
9
- ```
11
+ ---
10
12
 
11
- ## Usages
13
+ # ✨ Features
12
14
 
13
- ### TS file
15
+ * 📊 Multiple chart types
16
+ * ⚡ Powered by Apache ECharts
17
+ * 🔌 Angular Standalone Components
18
+ * 🎨 Built-in theme support
19
+ * 🖱 Click & drill-down events
20
+ * 🧩 Easy integration
21
+ * 📦 Lightweight and reusable
14
22
 
15
- ```
16
- import { ChartsLib } from 'cats-charts';
17
- ```
23
+ ---
18
24
 
19
- ### HTML template
25
+ # 📦 Installation
20
26
 
21
- ```
22
- <lib-charts-lib></lib-charts-lib>
27
+ Install the package along with required dependencies:
28
+
29
+ ```bash
30
+ npm install cats-charts echarts ngx-echarts
23
31
  ```
24
32
 
25
- ### Inputs
33
+ ---
26
34
 
27
- ```
28
- chartOptionsConfig: {} // accepts all options accepted by echarts
29
- chartType: 'bar' | 'area' | 'line' | 'pie' // by default chart type is bar
30
- columns: [] // list of columns
31
- contextMenuList: [] // list of context menu
32
- data: [] // list of set of data
33
- themeName: "default" | "dark" | "vintage" | "essos" | "chalk" | "roma" // default theme is default
35
+ # ⚙️ Setup ngx-echarts
36
+
37
+ Configure **ECharts** in your Angular application.
34
38
 
39
+ ### app.config.ts or app.module.ts
40
+
41
+ ```ts
42
+ import { provideEchartsCore } from 'ngx-echarts';
43
+ import * as echarts from 'echarts/core';
44
+
45
+ export const appConfig = {
46
+ providers: [
47
+ provideEchartsCore({ echarts })
48
+ ]
49
+ };
35
50
  ```
36
51
 
37
- ### Outputs
52
+ ---
53
+
54
+ # 🚀 Usage
38
55
 
56
+ ## Import Library
57
+
58
+ ```ts
59
+ import { ChartsLib } from 'cats-charts';
39
60
  ```
40
- handleSingleClick: (params) => {}
41
- handleDrillBy: (params) => {}
61
+
62
+ ---
63
+
64
+ ## HTML Example
65
+
66
+ ```html
67
+ <lib-charts-lib
68
+ [chartType]="'bar'"
69
+ [columns]="columns"
70
+ [data]="data"
71
+ [themeName]="'default'"
72
+ [showContextMenu]="true"
73
+ [contextMenuOptions]="contextMenuOptions"
74
+ (contextMenuClick)="onContextMenuClick($event)"
75
+ (chartEvent)="onChartEvent($event)"
76
+ ></lib-charts-lib>>
42
77
  ```
43
78
 
44
- ### Inputs Types
79
+ ---
80
+
81
+ <!-- # 📊 Example
82
+
83
+ ### Component TypeScript
84
+
85
+ ```ts
86
+ columns = ['Month', 'Sales'];
87
+
88
+ data = [
89
+ ['Jan', 120],
90
+ ['Feb', 200],
91
+ ['Mar', 150],
92
+ ['Apr', 80]
93
+ ];
94
+ ``` -->
95
+
96
+ ---
97
+
98
+ # ⚙️ Inputs
99
+
100
+ | Input | Type | Description |
101
+ |------|------|-------------|
102
+ | chartOptionsConfig | OptionsConfig | Accepts all Apache ECharts configuration options |
103
+ | chartType | 'bar' \| 'area' \| 'line' \| 'pie' | Chart type (default: `bar`) |
104
+ | columns | string[] | List of column names |
105
+ | data | any[][] | Dataset used for chart rendering |
106
+ | themeName | 'default' \| 'dark' \ | Chart theme |
107
+ | contextMenuList | ContextMenuListItem[] | Context menu configuration |
108
+ | contextMenuOptions | any[] | List of context menu items to display on right-click |
109
+ | showContextMenu | boolean | Whether to show the context menu on right-click (default: `false`) |
110
+
111
+ ---
45
112
 
113
+ # 📤 Outputs
114
+
115
+ | Output | Description |
116
+ |------|-------------|
117
+ | contextMenuClick | Triggered when a context menu item is clicked |
118
+ | chartEvent | Emits any ECharts chart events. Includes `type` (event name) and `data` (event params). |
119
+
120
+ ### Example
121
+
122
+ ```ts
123
+ onContextMenuClick(menuItem) {
124
+ console.log('Context menu clicked:', menuItem);
125
+ }
126
+
127
+ onChartEvent(event) {
128
+ console.log('Chart event:', event.type, event.data);
129
+ }
46
130
  ```
131
+
132
+ ---
133
+
134
+ # 🧠 Types
135
+
136
+ ```ts
47
137
  import type { ChartsLibType, OptionsConfig } from 'cats-charts';
48
138
 
49
139
  chartOptionsConfig: OptionsConfig
50
140
  chartType: ChartsLibType['chartType']
51
- columns: string[]
141
+ columns: string[]
52
142
  data: any[][]
53
143
  themeName: ChartsLibType['themeName']
54
144
  contextMenuList: ContextMenuListItem[]
55
145
  ```
56
146
 
57
- ## Additional Resources
147
+ ---
148
+
149
+ # 📊 Supported Charts
150
+
151
+ * Bar Chart
152
+ * Line Chart
153
+ * Area Chart
154
+ * Pie Chart
155
+ * Doughnut Chart
156
+ * Stacked Area Chart
157
+ * Sankey Chart
158
+ * Custom Charts
159
+
160
+ ---
161
+
162
+ # 🎨 Themes
163
+
164
+ Available chart themes:
165
+
166
+ * default
167
+ * dark
168
+ * vintage
169
+ * essos
170
+ * chalk
171
+ * roma
172
+
173
+ ---
174
+
175
+ # 📚 Documentation
176
+
177
+ Apache ECharts documentation:
178
+
179
+ https://echarts.apache.org/en/api.html#echarts
180
+
181
+ ---
182
+
183
+ # 🤝 Contributing
184
+
185
+ Contributions, issues, and feature requests are welcome.
186
+ Feel free to submit a pull request.
187
+
188
+ ---
189
+
190
+ # 📄 License
58
191
 
59
- For more information on Echarts, including detailed references, visit the [Official Apache Echarts](https://echarts.apache.org/en/api.html#echarts) page.
192
+ MIT License