Chart unstyled demo added

pull/4239/head
Tuğçe Küçükoğlu 2023-08-03 09:35:58 +03:00
parent 9a3f89eb23
commit 4a025bdfdf
4 changed files with 92 additions and 8 deletions

View File

@ -0,0 +1,47 @@
<template>
<DocSectionText v-bind="$attrs">
<p>Theming is implemented with the pass through properties in unstyled mode. Example below demonstrates the built-in Tailwind theme.</p>
</DocSectionText>
<DocSectionCode :code="code" :dependencies="{ 'chart.js': '3.3.2' }" component="Chart" embedded />
</template>
<script>
export default {
data() {
return {
code: {
composition: `
<template>
<div class="card">
<Chart type="bar" :data="chartData" :options="chartOptions" />
</div>
</template>
<script setup>
import { ref } from "vue";
const chartData = ref({
labels: ['Q1', 'Q2', 'Q3', 'Q4'],
datasets: [
{
label: 'Sales',
data: [540, 325, 702, 620],
backgroundColor: ['rgba(255, 159, 64, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(153, 102, 255, 0.2)'],
borderColor: ['rgb(255, 159, 64)', 'rgb(75, 192, 192)', 'rgb(54, 162, 235)', 'rgb(153, 102, 255)'],
borderWidth: 1
}
]
});
const chartOptions = ref({
scales: {
y: {
beginAtZero: true
}
}
});
<\/script>`
}
};
}
};
</script>

View File

@ -0,0 +1,33 @@
<template>
<div class="doc-main">
<div class="doc-intro">
<h1>Chart Theming</h1>
</div>
<DocSections :docs="docs" />
</div>
<DocSectionNav :docs="docs" />
</template>
<script>
import StyledDoc from './StyledDoc.vue';
import UnstyledDoc from './UnstyledDoc.vue';
export default {
data() {
return {
docs: [
{
id: 'styled',
label: 'Styled',
component: StyledDoc
},
{
id: 'unstyled',
label: 'Unstyled',
component: UnstyledDoc
}
]
};
}
};
</script>

View File

@ -1,5 +1,13 @@
<template>
<DocComponent title="Vue Chart Component" header="Chart" description="Chart components are based on Chart.js, an open source HTML5 based charting library." :componentDocs="docs" :apiDocs="['Chart']" :ptTabComponent="ptComponent" />
<DocComponent
title="Vue Chart Component"
header="Chart"
description="Chart components are based on Chart.js, an open source HTML5 based charting library."
:componentDocs="docs"
:apiDocs="['Chart']"
:ptTabComponent="ptComponent"
:themingDocs="themingDoc"
/>
</template>
<script>
@ -17,9 +25,9 @@ import PieChartDoc from '@/doc/chart/PieChartDoc';
import PolarAreaDoc from '@/doc/chart/PolarAreaDoc';
import RadarDoc from '@/doc/chart/RadarDoc';
import StackedBarDoc from '@/doc/chart/StackedBarDoc';
import StyleDoc from '@/doc/chart/StyleDoc';
import VerticalBarDoc from '@/doc/chart/VerticalBarDoc';
import PTComponent from '@/doc/chart/pt/index.vue';
import ThemingDoc from '@/doc/chart/theming/index.vue';
export default {
data() {
@ -95,18 +103,14 @@ export default {
label: 'Combo',
component: ComboDoc
},
{
id: 'style',
label: 'Style',
component: StyleDoc
},
{
id: 'accessibility',
label: 'Accessibility',
component: AccessibilityDoc
}
],
ptComponent: PTComponent
ptComponent: PTComponent,
themingDoc: ThemingDoc
};
}
};