Skip to content

Commit

Permalink
Merge pull request #73 from sgratzl/release/v4.2.1
Browse files Browse the repository at this point in the history
Release v4.2.1
  • Loading branch information
sgratzl authored Jul 7, 2023
2 parents 5f0a4a6 + c953313 commit c5f8efd
Show file tree
Hide file tree
Showing 50 changed files with 3,550 additions and 2,295 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
*.less text
*.styl text
*.js text
*.jsx text
*.ts text
*.tsx text
*.coffee text
*.json text
*.htm text
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
- run: yarn build
- run: yarn lint
- run: yarn test
- run: yarn samples
- uses: actions/upload-artifact@v2
if: failure()
with:
name: diff outputs
path: src/**/__diff_output__/*.png
- run: yarn docs:build
43 changes: 43 additions & 0 deletions .github/workflows/deploy_website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy Website
on:
workflow_dispatch: {}
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- run: npm i -g yarn
- run: yarn config set checksumBehavior ignore
- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: |
./.yarn/cache
./.yarn/unplugged
key: ${{ runner.os }}-yarn2-v5-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn2-v5
- run: yarn install
- run: yarn docs:build
- uses: actions/configure-pages@v2
- uses: actions/upload-pages-artifact@v1
with:
path: docs/.vitepress/dist
- name: Deploy
id: deployment
uses: actions/deploy-pages@v1
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ npm-debug.log*

*.tgz
/.vscode/extensions.json
/docs
*.tsbuildinfo
.eslintcache
__diff_output__

/samples/type_test.js
docs/.vitepress/dist
docs/.vitepress/cache
docs/.vitepress/config.ts.timestamp*
docs/api/
7 changes: 5 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
/.yarnrc.yml
/.yarn
/build
/docs
/docs/.vitepress/cache
/docs/.vitepress/dist
/docs/.vitepress/config.ts.timestamp*
/docs/api
/coverage
/.gitattributes
/.gitignore
Expand All @@ -14,4 +17,4 @@
*.tgz
*.tsbuildinfo
.eslintcache
/samples/type_test.js
.nojekyll
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.packageManager": "yarn",
"eslint.packageManager": "yarn",
"npm.packageManager": "yarn",
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",
Expand All @@ -23,7 +21,6 @@
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.detectIndentation": false,
"editor.tabSize": 2,
"liveServer.settings.port": 5504,
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
Expand Down
559 changes: 280 additions & 279 deletions .yarn/releases/yarn-3.5.0.cjs → .yarn/releases/yarn-3.6.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ packageExtensions:
dependencies:
eslint-import-resolver-node: "*"

yarnPath: .yarn/releases/yarn-3.5.0.cjs
yarnPath: .yarn/releases/yarn-3.6.1.cjs
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019-2022 Samuel Gratzl
Copyright (c) 2019-2023 Samuel Gratzl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ npm install --save chart.js chartjs-chart-graph

## Usage

see [Samples](https://github.com/sgratzl/chartjs-chart-graph/tree/main/samples) on Github
see [Examples](https://www.sgratzl.com/chartjs-chart-graph/examples/)

CodePens

Expand Down
61 changes: 61 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { defineConfig } from 'vitepress';
import { name, description, repository, license, author } from '../../package.json';
import typedocSidebar from '../api/typedoc-sidebar.json';

const cleanName = name.replace('@sgratzl/', '');

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: cleanName,
description,
base: `/${cleanName}/`,
useWebFonts: false,
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Getting Started', link: '/getting-started' },
{ text: 'Examples', link: '/examples/' },
{ text: 'API', link: '/api/' },
{ text: 'Related Plugins', link: '/related' },
],

sidebar: [
{
text: 'Examples',
items: [
{ text: 'Basic', link: '/examples/' },
{ text: 'Dendrogram', link: '/examples/dendrogram' },
{ text: 'Tree', link: '/examples/tree' },
{ text: 'Force Directed Graph', link: '/examples/force' },
{ text: 'Tree with Labels', link: '/examples/label' },
{ text: 'Directed Tree', link: '/examples/directed' },
{ text: 'Tree Orientations', link: '/examples/orientation' },
],
},
{
text: 'API',
collapsed: true,
items: typedocSidebar,
},
],

socialLinks: [{ icon: 'github', link: repository.url.replace('.git', '') }],

footer: {
message: `Released under the <a href="${repository.url.replace(
'.git',
''
)}/tree/main/LICENSE">${license} license</a>.`,
copyright: `Copyright © 2019-present <a href="${author.url}">${author.name}</a>`,
},

editLink: {
pattern: `${repository.url.replace('.git', '')}/edit/main/docs/:path`,
},

search: {
provider: 'local',
},
},
});
25 changes: 25 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Theme from 'vitepress/theme';
import { createTypedChart } from 'vue-chartjs';
import { Tooltip, LineElement, PointElement, LinearScale } from 'chart.js';
import { DendrogramController, ForceDirectedGraphController, EdgeLine, TreeController } from '../../../src';
import ChartPluginDataLabel from 'chartjs-plugin-datalabels';

export default {
...Theme,
enhanceApp({ app }) {
const deps = [
Tooltip,
LineElement,
PointElement,
DendrogramController,
ForceDirectedGraphController,
EdgeLine,
TreeController,
LinearScale,
ChartPluginDataLabel,
];
app.component('DendrogramChart', createTypedChart('dendrogram', deps));
app.component('TreeChart', createTypedChart('tree', deps));
app.component('ForceDirectedGraphChart', createTypedChart('forceDirectedGraph', deps));
},
};
24 changes: 24 additions & 0 deletions docs/examples/dendrogram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: Dendrogram
---

# Dendrogram

<script setup>
import {config} from './dendrogram';
</script>

<DendrogramChart
:options="config.options"
:data="config.data"
/>

### Code

:::code-group

<<< ./dendrogram.ts#config [config]

<<< ./dendrogram.ts#data [data]

:::
31 changes: 31 additions & 0 deletions docs/examples/dendrogram.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { ChartConfiguration } from 'chart.js';
import type {} from '../../src';
import 'chartjs-plugin-datalabels';

// #region data
import nodes from './tree.json';

export const data: ChartConfiguration<'dendrogram'>['data'] = {
labels: nodes.map((d) => d.name),
datasets: [
{
pointBackgroundColor: 'steelblue',
pointRadius: 5,
data: nodes.map((d) => Object.assign({}, d)),
},
],
};
// #endregion data
// #region config
export const config: ChartConfiguration<'dendrogram'> = {
type: 'dendrogram',
data,
options: {
plugins: {
datalabels: {
display: false,
},
},
},
};
// #endregion config
24 changes: 24 additions & 0 deletions docs/examples/directed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: Directed Tree
---

# Directed Tree

<script setup>
import {config} from './directed';
</script>

<TreeChart
:options="config.options"
:data="config.data"
/>

### Code

:::code-group

<<< ./directed.ts#config [config]

<<< ./directed.ts#data [data]

:::
32 changes: 32 additions & 0 deletions docs/examples/directed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { ChartConfiguration } from 'chart.js';
import type {} from '../../src';
import 'chartjs-plugin-datalabels';

// #region data
import nodes from './tree.json';

export const data: ChartConfiguration<'tree'>['data'] = {
labels: nodes.map((d) => d.name),
datasets: [
{
pointBackgroundColor: 'steelblue',
pointRadius: 5,
directed: true,
data: nodes.map((d) => Object.assign({}, d)),
},
],
};
// #endregion data
// #region config
export const config: ChartConfiguration<'tree'> = {
type: 'tree',
data,
options: {
plugins: {
datalabels: {
display: false,
},
},
},
};
// #endregion config
24 changes: 24 additions & 0 deletions docs/examples/force.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: Force Directed Graph
---

# Force Directed Graph

<script setup>
import {config} from './force';
</script>

<ForceDirectedGraphChart
:options="config.options"
:data="config.data"
/>

### Code

:::code-group

<<< ./force.ts#config [config]

<<< ./force.ts#data [data]

:::
31 changes: 31 additions & 0 deletions docs/examples/force.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { ChartConfiguration } from 'chart.js';
import type {} from '../../src';
import 'chartjs-plugin-datalabels';

// #region data
import miserables from './miserables.json';
export const data: ChartConfiguration<'forceDirectedGraph'>['data'] = {
labels: miserables.nodes.map((d) => d.id),
datasets: [
{
pointBackgroundColor: 'steelblue',
pointRadius: 5,
data: miserables.nodes,
edges: miserables.links,
},
],
};
// #endregion data
// #region config
export const config: ChartConfiguration<'forceDirectedGraph'> = {
type: 'forceDirectedGraph',
data,
options: {
plugins: {
datalabels: {
display: false,
},
},
},
};
// #endregion config
Loading

0 comments on commit c5f8efd

Please sign in to comment.