Skip to content

Commit 0a7e8ae

Browse files
authored
Merge pull request #47 from sgratzl/release/v4.3.1
Release v4.3.1
2 parents 954671a + 6c66022 commit 0a7e8ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+4480
-3538
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
*.less text
2121
*.styl text
2222
*.js text
23+
*.jsx text
2324
*.ts text
25+
*.tsx text
2426
*.coffee text
2527
*.json text
2628
*.htm text

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
- run: yarn build
2626
- run: yarn lint
2727
- run: yarn test
28-
# - run: yarn samples
2928
- uses: actions/upload-artifact@v2
3029
if: failure()
3130
with:
3231
name: diff outputs
3332
path: src/**/__diff_output__/*.png
33+
- run: yarn docs:build

.github/workflows/deploy_website.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy Website
2+
on:
3+
workflow_dispatch: {}
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pages: write
12+
id-token: write
13+
environment:
14+
name: github-pages
15+
url: ${{ steps.deployment.outputs.page_url }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 16
23+
cache: npm
24+
- run: npm i -g yarn
25+
- run: yarn config set checksumBehavior ignore
26+
- name: Cache Node.js modules
27+
uses: actions/cache@v3
28+
with:
29+
path: |
30+
./.yarn/cache
31+
./.yarn/unplugged
32+
key: ${{ runner.os }}-yarn2-v5-${{ hashFiles('**/yarn.lock') }}
33+
restore-keys: |
34+
${{ runner.os }}-yarn2-v5
35+
- run: yarn install
36+
- run: yarn docs:build
37+
- uses: actions/configure-pages@v2
38+
- uses: actions/upload-pages-artifact@v1
39+
with:
40+
path: docs/.vitepress/dist
41+
- name: Deploy
42+
id: deployment
43+
uses: actions/deploy-pages@v1

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ npm-debug.log*
1919

2020
*.tgz
2121
/.vscode/extensions.json
22-
/docs
2322
*.tsbuildinfo
2423
.eslintcache
2524
__diff_output__
2625

27-
/samples/type_test.js
28-
.idea
29-
.idea/*
26+
docs/.vitepress/dist
27+
docs/.vitepress/cache
28+
docs/.vitepress/config.ts.timestamp*
29+
docs/api/

.prettierignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
/.yarnrc.yml
33
/.yarn
44
/build
5-
/docs
5+
/docs/.vitepress/cache
6+
/docs/.vitepress/dist
7+
/docs/.vitepress/config.ts.timestamp*
8+
/docs/api
69
/coverage
710
/.gitattributes
811
/.gitignore
@@ -14,4 +17,4 @@
1417
*.tgz
1518
*.tsbuildinfo
1619
.eslintcache
17-
/samples/type_test.js
20+
.nojekyll

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
"[yaml]": {
1414
"editor.defaultFormatter": "esbenp.prettier-vscode"
1515
},
16+
"npm.packageManager": "yarn",
1617
"eslint.nodePath": ".yarn/sdks",
1718
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",
1819
"files.eol": "\n",
1920
"typescript.tsdk": ".yarn/sdks/typescript/lib",
2021
"typescript.enablePromptUseWorkspaceTsdk": true,
21-
"liveServer.settings.port": 5501,
22+
"editor.detectIndentation": false,
23+
"editor.tabSize": 2,
2224
"search.exclude": {
2325
"**/.yarn": true,
2426
"**/.pnp.*": true

.yarn/releases/yarn-3.5.0.cjs renamed to .yarn/releases/yarn-3.6.1.cjs

Lines changed: 280 additions & 279 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ packageExtensions:
33
dependencies:
44
eslint-import-resolver-node: "*"
55

6-
yarnPath: .yarn/releases/yarn-3.5.0.cjs
6+
yarnPath: .yarn/releases/yarn-3.6.1.cjs

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019-2022 Samuel Gratzl
3+
Copyright (c) 2019-2023 Samuel Gratzl
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ npm install --save chart.js chartjs-plugin-hierarchical
2626

2727
## Usage
2828

29-
see [Samples](https://github.com/sgratzl/chartjs-plugin-hierarchical/tree/main/samples) on Github
29+
see [Examples](https://www.sgratzl.com/chartjs-plugin-hierarchical/examples/)
3030

3131
or at this [![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/KKdryvg)
3232

@@ -38,86 +38,11 @@ a new scale type `hierarchical`.
3838

3939
The `hierarchical` axis scale has the following styling options
4040

41-
```ts
42-
interface IHierarchicalScaleOptions {
43-
/**
44-
* ratio by which the distance between two elements shrinks the higher the level of the tree is. i.e. two two level bars have a distance of 1. two nested one just 0.75
45-
* @default 0.75
46-
*/
47-
levelPercentage: number;
48-
/**
49-
* padding of the first collapse to the start of the x-axis
50-
* @default 25
51-
*/
52-
padding: number;
53-
/**
54-
* position of the hierarchy label in expanded levels, null to disable
55-
* @default 'below'
56-
*/
57-
hierarchyLabelPosition: 'below' | 'above' | null;
58-
59-
/**
60-
* position of the hierarchy group label relative to the its children
61-
* @default between-first-and-second
62-
*/
63-
hierarchyGroupLabelPosition: 'center' | 'first' | 'last' | 'between-first-and-second';
64-
65-
/**
66-
* whether interactive buttons should be shown or whether it should be static
67-
* @default false
68-
*/
69-
static: boolean;
70-
71-
/**
72-
* object of attributes that should be managed and extracted from the tree
73-
* data structures such as `backgroundColor` for coloring individual bars
74-
* the object contains the key and default value
75-
* @default {}
76-
*/
77-
attributes: { [attribute: string]: any };
78-
}
79-
```
41+
see [IHierarchicalScaleOptions](https://www.sgratzl/com/chartjs-plugin-hierarchical/api/interfaces/interface.IHierarchicalScaleOptions.html)
8042

8143
## Data structure
8244

83-
```ts
84-
interface ILabelNode {
85-
/**
86-
* label
87-
*/
88-
label: string;
89-
/**
90-
* defines whether this node is collapsed (false) or expanded (true) or focussed ('focus')
91-
* @default false
92-
*/
93-
expand?: boolean | 'focus';
94-
/**
95-
* list of children
96-
*/
97-
children?: ISubLabelNode[];
98-
}
99-
100-
/**
101-
* a label entry can be a single string or a complex ILabelNode
102-
*/
103-
declare type ISubLabelNode = ILabelNode | string;
104-
105-
interface IValueNode<T> {
106-
/**
107-
* the actual value of this node
108-
*/
109-
value: T;
110-
/**
111-
* list of children
112-
*/
113-
children?: ISubValueNode<T>[];
114-
}
115-
116-
/**
117-
* a value entry can be a single value or a complex IValueNode
118-
*/
119-
declare type ISubValueNode<T> = IValueNode<T> | T;
120-
```
45+
see [ILabelNode](https://www.sgratzl/com/chartjs-plugin-hierarchical/api/interfaces/interface.ILabelNode.html) and [IValueNode](https://www.sgratzl/com/chartjs-plugin-hierarchical/api/interfaces/interface.IValueNode.html)
12146

12247
### ESM and Tree Shaking
12348

docs/.vitepress/config.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { defineConfig } from 'vitepress';
2+
import { name, description, repository, license, author } from '../../package.json';
3+
import typedocSidebar from '../api/typedoc-sidebar.json';
4+
5+
const cleanName = name.replace('@sgratzl/', '');
6+
7+
// https://vitepress.dev/reference/site-config
8+
export default defineConfig({
9+
title: cleanName,
10+
description,
11+
base: `/${cleanName}/`,
12+
useWebFonts: false,
13+
themeConfig: {
14+
// https://vitepress.dev/reference/default-theme-config
15+
nav: [
16+
{ text: 'Home', link: '/' },
17+
{ text: 'Getting Started', link: '/getting-started' },
18+
{ text: 'Examples', link: '/examples/' },
19+
{ text: 'API', link: '/api/' },
20+
{ text: 'Related Plugins', link: '/related' },
21+
],
22+
23+
sidebar: [
24+
{
25+
text: 'Examples',
26+
items: [
27+
{ text: 'Basic', link: '/examples/' },
28+
{ text: 'Single Node', link: '/examples/single' },
29+
{ text: 'Attributes', link: '/examples/attributes' },
30+
{ text: 'Scriptable', link: '/examples/scriptable' },
31+
{ text: 'Static Expansion', link: '/examples/static' },
32+
{ text: 'Single Child', link: '/examples/singleChild' },
33+
{ text: 'Horizontal Scale', link: '/examples/horizontal' },
34+
{ text: 'Horizontal Scale (Reversed)', link: '/examples/horizontalReverse' },
35+
{ text: 'Deep Hierarchy', link: '/examples/deep' },
36+
{ text: 'Line Chart', link: '/examples/line' },
37+
{ text: 'End Hierarchy', link: '/examples/endHierarchy' },
38+
{ text: 'No Label', link: '/examples/noLabel' },
39+
//
40+
],
41+
},
42+
{
43+
text: 'API',
44+
collapsed: true,
45+
items: typedocSidebar,
46+
},
47+
],
48+
49+
socialLinks: [{ icon: 'github', link: repository.url.replace('.git', '') }],
50+
51+
footer: {
52+
message: `Released under the <a href="${repository.url.replace(
53+
'.git',
54+
''
55+
)}/tree/main/LICENSE">${license} license</a>.`,
56+
copyright: `Copyright © 2019-present <a href="${author.url}">${author.name}</a>`,
57+
},
58+
59+
editLink: {
60+
pattern: `${repository.url.replace('.git', '')}/edit/main/docs/:path`,
61+
},
62+
63+
search: {
64+
provider: 'local',
65+
},
66+
},
67+
});

docs/.vitepress/theme/index.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import Theme from 'vitepress/theme';
2+
import { Chart } from 'vue-chartjs';
3+
import {
4+
Chart as ChartJS,
5+
CategoryScale,
6+
Tooltip,
7+
LinearScale,
8+
BarController,
9+
BarElement,
10+
LineController,
11+
Colors,
12+
LineElement,
13+
PointElement,
14+
} from 'chart.js';
15+
import { HierarchicalScale } from '../../../src';
16+
17+
export default {
18+
...Theme,
19+
enhanceApp({ app }) {
20+
ChartJS.register(
21+
HierarchicalScale,
22+
CategoryScale,
23+
Tooltip,
24+
LinearScale,
25+
BarController,
26+
BarElement,
27+
LineController,
28+
LineElement,
29+
PointElement,
30+
Colors
31+
);
32+
app.component('Chart', Chart);
33+
},
34+
};

docs/examples/attributes.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Attributes
3+
---
4+
5+
# Attributes
6+
7+
<script setup>
8+
import {config} from './attributes';
9+
</script>
10+
11+
<Chart
12+
:type="config.type"
13+
:options="config.options"
14+
:data="config.data"
15+
/>
16+
17+
### Code
18+
19+
:::code-group
20+
21+
<<< ./attributes.ts#config [config]
22+
23+
<<< ./attributes.ts#data [data]
24+
25+
:::

0 commit comments

Comments
 (0)