Skip to content

Commit b939b75

Browse files
committed
fix: restore docs
1 parent 96b8490 commit b939b75

File tree

13 files changed

+774
-0
lines changed

13 files changed

+774
-0
lines changed

docs/.vitepress/config.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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: 'Log Scale', link: '/examples/log' },
29+
{ text: 'Tension', link: '/examples/tension' },
30+
],
31+
},
32+
{
33+
text: 'API',
34+
collapsed: true,
35+
items: typedocSidebar,
36+
},
37+
],
38+
39+
socialLinks: [{ icon: 'github', link: repository.url.replace('.git', '') }],
40+
41+
footer: {
42+
message: `Released under the <a href="${repository.url.replace(
43+
'.git',
44+
''
45+
)}/tree/main/LICENSE">${license} license</a>.`,
46+
copyright: `Copyright © 2019-present <a href="${author.url}">${author.name}</a>`,
47+
},
48+
49+
editLink: {
50+
pattern: `${repository.url.replace('.git', '')}/edit/main/docs/:path`,
51+
},
52+
53+
search: {
54+
provider: 'local',
55+
},
56+
},
57+
});

docs/.vitepress/theme/index.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import Theme from 'vitepress/theme';
2+
import { createTypedChart } from 'vue-chartjs';
3+
import { CategoryScale, Tooltip, LinearScale, LogarithmicScale, Legend } from 'chart.js';
4+
import {
5+
LineSegment,
6+
ParallelCoordinatesController,
7+
PCPScale,
8+
LinearAxis,
9+
LogarithmicAxis,
10+
LogarithmicParallelCoordinatesController,
11+
} from '../../../src';
12+
13+
export default {
14+
...Theme,
15+
enhanceApp({ app }) {
16+
app.component(
17+
'PCPChart',
18+
createTypedChart('pcp', [
19+
CategoryScale,
20+
Tooltip,
21+
Legend,
22+
LinearScale,
23+
LogarithmicScale,
24+
LineSegment,
25+
PCPScale,
26+
ParallelCoordinatesController,
27+
LogarithmicParallelCoordinatesController,
28+
])
29+
);
30+
},
31+
};

docs/examples/basic.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { ChartConfiguration } from 'chart.js';
2+
import { Chart } from 'chart.js';
3+
import { LinearAxis, LogarithmicAxis } from '../../src';
4+
5+
// #region data
6+
import mtcars from './data/index.json';
7+
8+
const attrs = ['mpg', 'hp', 'wt', 'qsec', 'gear', 'drat', 'disp', 'cyl', 'am'];
9+
10+
export const data: ChartConfiguration<'pcp'>['data'] = {
11+
labels: mtcars.map((c) => c.model),
12+
datasets: attrs.map((attr) => ({
13+
label: attr,
14+
data: mtcars.map((c) => c[attr]),
15+
})),
16+
};
17+
18+
// #endregion
19+
20+
Chart.registry.addElements(LinearAxis, LogarithmicAxis);
21+
22+
// #region config
23+
export const config: ChartConfiguration<'pcp'> = {
24+
type: 'pcp',
25+
data,
26+
};
27+
// #endregion config

docs/examples/data/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://raw.githubusercontent.com/derhuerst/mtcars/master/index.json

0 commit comments

Comments
 (0)