-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
717 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
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: 'Bar Chart', link: '/examples/bar' }, | ||
{ text: 'Line Chart', link: '/examples/line' }, | ||
{ text: 'Scatter Chart', link: '/examples/scatter' }, | ||
{ text: 'Polar Area Chart', link: '/examples/polarArea' }, | ||
{ text: 'Horizontal Bar Chart', link: '/examples/horizontalBar' }, | ||
{ text: 'Multiple Error Bars', link: '/examples/multibar' }, | ||
{ text: 'Line As Scatter Chart', link: '/examples/lineScatter' }, | ||
{ text: 'Line Timeseries Chart', link: '/examples/lineTime' }, | ||
], | ||
}, | ||
{ | ||
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', | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import Theme from 'vitepress/theme'; | ||
import { createTypedChart } from 'vue-chartjs'; | ||
import { | ||
LinearScale, | ||
CategoryScale, | ||
RadialLinearScale, | ||
Tooltip, | ||
Colors, | ||
BarElement, | ||
LineElement, | ||
PointElement, | ||
BarController, | ||
LineController, | ||
TimeScale, | ||
} from 'chart.js'; | ||
import { | ||
ArcWithErrorBar, | ||
BarWithErrorBar, | ||
BarWithErrorBarsController, | ||
LineWithErrorBarsController, | ||
PolarAreaWithErrorBarsController, | ||
PointWithErrorBar, | ||
ScatterWithErrorBarsController, | ||
} from '../../../src'; | ||
|
||
export default { | ||
...Theme, | ||
enhanceApp({ app }) { | ||
const deps = [ | ||
LinearScale, | ||
CategoryScale, | ||
RadialLinearScale, | ||
TimeScale, | ||
ArcWithErrorBar, | ||
BarWithErrorBar, | ||
BarWithErrorBarsController, | ||
LineWithErrorBarsController, | ||
PolarAreaWithErrorBarsController, | ||
PointWithErrorBar, | ||
ScatterWithErrorBarsController, | ||
Tooltip, | ||
Colors, | ||
BarElement, | ||
LineElement, | ||
PointElement, | ||
BarController, | ||
LineController, | ||
]; | ||
app.component('BarWithErrorBarsChart', createTypedChart('barWithErrorBars', deps)); | ||
app.component('LineWithErrorBarsChart', createTypedChart('lineWithErrorBars', deps)); | ||
app.component('PolarAreaWithErrorBarsChart', createTypedChart('polarAreaWithErrorBars', deps)); | ||
app.component('ScatterWithErrorBarsChart', createTypedChart('scatterWithErrorBars', deps)); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: Bar With Error Bars | ||
--- | ||
|
||
# Bar With Error Bars | ||
|
||
<script setup> | ||
import {config as bar} from './bar'; | ||
</script> | ||
|
||
<BarWithErrorBarsChart | ||
:options="bar.options" | ||
:data="bar.data" | ||
/> | ||
|
||
### Code | ||
|
||
<<< ./bar.ts#config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { ChartConfiguration } from 'chart.js'; | ||
import type {} from '../../src'; | ||
|
||
// #region config | ||
export const config: ChartConfiguration<'barWithErrorBars'> = { | ||
type: 'barWithErrorBars', | ||
data: { | ||
labels: ['A', 'B'], | ||
datasets: [ | ||
{ | ||
data: [ | ||
{ | ||
y: 4, | ||
yMin: 1, | ||
yMax: 6, | ||
}, | ||
{ | ||
y: 2, | ||
yMin: 1, | ||
yMax: 4, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
// #endregion config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import type { ChartConfiguration } from 'chart.js'; | ||
import type {} from '../../src'; | ||
|
||
// #region bar | ||
export const bar: ChartConfiguration<'barWithErrorBars'> = { | ||
type: 'barWithErrorBars', | ||
data: { | ||
labels: ['A', 'B'], | ||
datasets: [ | ||
{ | ||
data: [ | ||
{ | ||
y: 4, | ||
yMin: 1, | ||
yMax: 6, | ||
}, | ||
{ | ||
y: 2, | ||
yMin: 1, | ||
yMax: 4, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
// #endregion bar | ||
|
||
// #region scatter | ||
export const scatter: ChartConfiguration<'scatterWithErrorBars'> = { | ||
type: 'scatterWithErrorBars', | ||
data: { | ||
labels: ['A', 'B'], | ||
datasets: [ | ||
{ | ||
data: [ | ||
{ | ||
x: 2, | ||
xMin: 1, | ||
xMax: 3, | ||
y: 4, | ||
yMin: 1, | ||
yMax: 6, | ||
}, | ||
{ | ||
x: 7, | ||
xMin: 6, | ||
xMax: 9, | ||
y: 2, | ||
yMin: 1, | ||
yMax: 4, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
// #endregion scatter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: Horizontal Bar With Error Bars | ||
--- | ||
|
||
# Horizontal Bar With Error Bars | ||
|
||
<script setup> | ||
import {config as bar} from './horizontalBar'; | ||
</script> | ||
|
||
<BarWithErrorBarsChart | ||
:options="bar.options" | ||
:data="bar.data" | ||
/> | ||
|
||
### Code | ||
|
||
<<< ./horizontalBar.ts#config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { ChartConfiguration } from 'chart.js'; | ||
import type {} from '../../src'; | ||
|
||
// #region config | ||
export const config: ChartConfiguration<'barWithErrorBars'> = { | ||
type: 'barWithErrorBars', | ||
data: { | ||
labels: ['A', 'B'], | ||
datasets: [ | ||
{ | ||
data: [ | ||
{ | ||
x: 4, | ||
xMin: 1, | ||
xMax: 6, | ||
}, | ||
{ | ||
x: 2, | ||
xMin: 1, | ||
xMax: 4, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
options: { | ||
indexAxis: 'y', | ||
}, | ||
}; | ||
// #endregion config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: Examples | ||
--- | ||
|
||
# Examples | ||
|
||
<script setup> | ||
import {config as bar} from './bar'; | ||
import {config as line} from './line'; | ||
import {config as scatter} from './scatter'; | ||
import {config as polarArea} from './polarArea'; | ||
</script> | ||
|
||
## Bar With Error Bars | ||
|
||
<BarWithErrorBarsChart | ||
:options="bar.options" | ||
:data="bar.data" | ||
/> | ||
|
||
### Code | ||
|
||
<<< ./bar.ts#config | ||
|
||
## Line With Error Bars | ||
|
||
<LineWithErrorBarsChart | ||
:options="line.options" | ||
:data="line.data" | ||
/> | ||
|
||
### Code | ||
|
||
<<< ./line.ts#config | ||
|
||
## Scatter With Error Bars | ||
|
||
<ScatterWithErrorBarsChart | ||
:options="scatter.options" | ||
:data="scatter.data" | ||
/> | ||
|
||
### Code | ||
|
||
<<< ./scatter.ts#config | ||
|
||
## Polar Area With Error Bars | ||
|
||
<PolarAreaWithErrorBarsChart | ||
:options="polarArea.options" | ||
:data="polarArea.data" | ||
/> | ||
|
||
### Code | ||
|
||
<<< ./polarArea.ts#config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: Line With Error Bars | ||
--- | ||
|
||
# Lien With Error Bars | ||
|
||
<script setup> | ||
import {config as line} from './line'; | ||
</script> | ||
|
||
<LineWithErrorBarsChart | ||
:options="line.options" | ||
:data="line.data" | ||
/> | ||
|
||
### Code | ||
|
||
<<< ./line.ts#config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { ChartConfiguration } from 'chart.js'; | ||
import type {} from '../../src'; | ||
|
||
// #region config | ||
export const config: ChartConfiguration<'lineWithErrorBars'> = { | ||
type: 'lineWithErrorBars', | ||
data: { | ||
labels: ['A', 'B'], | ||
datasets: [ | ||
{ | ||
data: [ | ||
{ | ||
y: 4, | ||
yMin: 1, | ||
yMax: 6, | ||
}, | ||
{ | ||
y: 2, | ||
yMin: 1, | ||
yMax: 4, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
// #endregion config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: Line As Scatter With Error Bars | ||
--- | ||
|
||
# Lien As Scatter With Error Bars | ||
|
||
<script setup> | ||
import {config} from './lineScatter'; | ||
</script> | ||
|
||
<LineWithErrorBarsChart | ||
:options="config.options" | ||
:data="config.data" | ||
/> | ||
|
||
### Code | ||
|
||
<<< ./lineScatter.ts#config |
Oops, something went wrong.