stockchart-treemap 1.0.0 → 1.0.1
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 +89 -90
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 stockchart-treemap 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,90 +1,89 @@
|
|
|
1
|
-
# stockchart-treemap
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
`<stockchart-treemap>`
|
|
49
|
-
|
|
50
|
-
##
|
|
51
|
-
```ts
|
|
52
|
-
import { AppStockchartTreemapExampleComponent, createMockMarketMap } from 'stockchart-treemap';
|
|
53
|
-
|
|
54
|
-
@Component({
|
|
55
|
-
standalone: true,
|
|
56
|
-
imports: [AppStockchartTreemapExampleComponent]
|
|
57
|
-
})
|
|
58
|
-
export class DemoHost {}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
[
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Плитки не содержат поля `color`, поэтому библиотека самостоятельно рассчитывает оттенки на основе значений из `change`.
|
|
1
|
+
# stockchart-treemap
|
|
2
|
+
|
|
3
|
+
Standalone TreeMap component for Angular, ready to publish to npm. This is an independent port of the Kendo TreeMap functionality implemented on fully independent code (no Kendo UI runtime dependencies). The component is standalone, supports highlighting via `TreeMapColorScale`, accepts array/Observable/loader data sources, and lets you supply custom tile and header templates.
|
|
4
|
+
|
|
5
|
+
## Live demo
|
|
6
|
+
- Updated StackBlitz example: https://stackblitz.com/edit/stackblitz-starters-drgync8z?file=README.md
|
|
7
|
+
|
|
8
|
+
## Build and publish
|
|
9
|
+
1. Build the library:
|
|
10
|
+
```bash
|
|
11
|
+
npm run ng -- build stockchart-treemap
|
|
12
|
+
```
|
|
13
|
+
2. Publish from the build output (make sure you are authenticated in npm):
|
|
14
|
+
```bash
|
|
15
|
+
cd dist/stockchart-treemap
|
|
16
|
+
npm publish --access public
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Build example components for debugging
|
|
20
|
+
For local testing and step-by-step debugging of the demo components, build the separate `stockchart-treemap-examples` package:
|
|
21
|
+
```bash
|
|
22
|
+
npm run build:stockchart-treemap-examples
|
|
23
|
+
```
|
|
24
|
+
The build uses the examples tsconfig and places artifacts in `dist/stockchart-treemap-examples` so they can be consumed in a sandbox or external app without touching the main package.
|
|
25
|
+
|
|
26
|
+
To view the examples live, run the dev server with the desired configuration:
|
|
27
|
+
```bash
|
|
28
|
+
# market map on the default 4200 port
|
|
29
|
+
ng serve stockchart-treemap-examples
|
|
30
|
+
|
|
31
|
+
# variant with custom colors on port 4200
|
|
32
|
+
ng serve stockchart-treemap-examples --configuration self-colored
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Bootstrapping
|
|
36
|
+
```ts
|
|
37
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
38
|
+
import { AppComponent } from './app/app.component';
|
|
39
|
+
import { TreeMapComponent } from 'stockchart-treemap';
|
|
40
|
+
|
|
41
|
+
bootstrapApplication(AppComponent, {
|
|
42
|
+
providers: [
|
|
43
|
+
// TreeMapComponent is added as a standalone import on the components that use it
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Add `TreeMapComponent` or the ready-made demo wrappers to the `imports` of the host component and use the `<stockchart-treemap>` selector directly in the template.
|
|
49
|
+
|
|
50
|
+
## Example `<app-stockchart-treemap>` with generated data
|
|
51
|
+
```ts
|
|
52
|
+
import { AppStockchartTreemapExampleComponent, createMockMarketMap } from 'stockchart-treemap';
|
|
53
|
+
|
|
54
|
+
@Component({
|
|
55
|
+
standalone: true,
|
|
56
|
+
imports: [AppStockchartTreemapExampleComponent]
|
|
57
|
+
})
|
|
58
|
+
export class DemoHost {}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The example component generates a tree with sectors and tickers, sets `colorValueField: 'change'`, and applies `TreeMapColorScale` for smooth gain/loss highlighting.
|
|
62
|
+
|
|
63
|
+
## Basic usage with automatic colors
|
|
64
|
+
```html
|
|
65
|
+
<stockchart-treemap
|
|
66
|
+
[data]="data"
|
|
67
|
+
[options]="{ textField: 'name', valueField: 'value', colorValueField: 'change', colorScale: performanceColorScale }">
|
|
68
|
+
</stockchart-treemap>
|
|
69
|
+
```
|
|
70
|
+
```ts
|
|
71
|
+
import { performanceColorScale, createPerformanceTreemap } from 'stockchart-treemap';
|
|
72
|
+
|
|
73
|
+
@Component({
|
|
74
|
+
standalone: true,
|
|
75
|
+
imports: [TreeMapComponent]
|
|
76
|
+
})
|
|
77
|
+
export class SimpleDemo {
|
|
78
|
+
data = createPerformanceTreemap();
|
|
79
|
+
options = {
|
|
80
|
+
textField: 'name',
|
|
81
|
+
valueField: 'value',
|
|
82
|
+
colorValueField: 'change',
|
|
83
|
+
colorScale: performanceColorScale,
|
|
84
|
+
colors: []
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Tiles omit the `color` field, so the library computes shades automatically from `change`.
|