@chartts/vue 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.cjs +345 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +5992 -0
- package/dist/index.d.ts +5992 -0
- package/dist/index.js +120 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { defineComponent, ref, h, onMounted, watch, onUnmounted } from 'vue';
|
|
2
|
+
import { createChart, lineChartType, barChartType, stackedBarChartType, horizontalBarChartType, pieChartType, donutChartType, scatterChartType, sparklineChartType, areaChartType, radarChartType, bubbleChartType, candlestickChartType, gaugeChartType, waterfallChartType, funnelChartType, heatmapChartType, boxplotChartType, histogramChartType, treemapChartType, polarChartType, radialBarChartType, lollipopChartType, bulletChartType, dumbbellChartType, calendarChartType, comboChartType, sankeyChartType, sunburstChartType, treeChartType, graphChartType, parallelChartType, themeRiverChartType, pictorialBarChartType, chordChartType, geoChartType, linesChartType, matrixChartType, customChartType, ohlcChartType, stepChartType, volumeChartType, rangeChartType, baselineChartType, kagiChartType, renkoChartType } from '@chartts/core';
|
|
3
|
+
export { areaChartType, barChartType, baselineChartType, boxplotChartType, bubbleChartType, bulletChartType, calendarChartType, candlestickChartType, chordChartType, comboChartType, customChartType, donutChartType, dumbbellChartType, funnelChartType, gaugeChartType, geoChartType, graphChartType, heatmapChartType, histogramChartType, horizontalBarChartType, kagiChartType, lineChartType, linesChartType, lollipopChartType, matrixChartType, ohlcChartType, parallelChartType, pictorialBarChartType, pieChartType, polarChartType, radarChartType, radialBarChartType, rangeChartType, renkoChartType, sankeyChartType, scatterChartType, sparklineChartType, stackedBarChartType, stepChartType, sunburstChartType, themeRiverChartType, treeChartType, treemapChartType, volumeChartType, waterfallChartType } from '@chartts/core';
|
|
4
|
+
|
|
5
|
+
// src/index.ts
|
|
6
|
+
function useChart(containerRef, chartType, getData, getOptions) {
|
|
7
|
+
let instance = null;
|
|
8
|
+
onMounted(() => {
|
|
9
|
+
if (!containerRef.value) return;
|
|
10
|
+
instance = createChart(containerRef.value, chartType, getData(), getOptions());
|
|
11
|
+
});
|
|
12
|
+
watch(getData, (data) => {
|
|
13
|
+
instance?.setData(data);
|
|
14
|
+
}, { deep: true });
|
|
15
|
+
watch(getOptions, (opts) => {
|
|
16
|
+
instance?.setOptions(opts);
|
|
17
|
+
}, { deep: true });
|
|
18
|
+
onUnmounted(() => {
|
|
19
|
+
instance?.destroy();
|
|
20
|
+
instance = null;
|
|
21
|
+
});
|
|
22
|
+
return { getInstance: () => instance };
|
|
23
|
+
}
|
|
24
|
+
var chartProps = {
|
|
25
|
+
data: { type: Object, required: true },
|
|
26
|
+
theme: { type: [String, Object] },
|
|
27
|
+
width: { type: Number },
|
|
28
|
+
height: { type: Number },
|
|
29
|
+
xLabel: { type: String },
|
|
30
|
+
yLabel: { type: String },
|
|
31
|
+
xGrid: { type: Boolean },
|
|
32
|
+
yGrid: { type: Boolean },
|
|
33
|
+
xAxis: { type: Boolean },
|
|
34
|
+
yAxis: { type: Boolean },
|
|
35
|
+
legend: { type: [Boolean, String] },
|
|
36
|
+
tooltip: { type: [Boolean, Object] },
|
|
37
|
+
animate: { type: Boolean },
|
|
38
|
+
colors: { type: Array },
|
|
39
|
+
curve: { type: String },
|
|
40
|
+
barRadius: { type: Number },
|
|
41
|
+
barGap: { type: Number },
|
|
42
|
+
yMin: { type: Number },
|
|
43
|
+
yMax: { type: Number },
|
|
44
|
+
ariaLabel: { type: String }
|
|
45
|
+
};
|
|
46
|
+
function propsToOptions(props) {
|
|
47
|
+
const opts = {};
|
|
48
|
+
const skip = /* @__PURE__ */ new Set(["data", "class", "style"]);
|
|
49
|
+
for (const [key, value] of Object.entries(props)) {
|
|
50
|
+
if (skip.has(key) || value === void 0) continue;
|
|
51
|
+
opts[key] = value;
|
|
52
|
+
}
|
|
53
|
+
return opts;
|
|
54
|
+
}
|
|
55
|
+
function createVueChart(chartType, name) {
|
|
56
|
+
return defineComponent({
|
|
57
|
+
name,
|
|
58
|
+
props: chartProps,
|
|
59
|
+
setup(props, { expose }) {
|
|
60
|
+
const container = ref();
|
|
61
|
+
const { getInstance } = useChart(
|
|
62
|
+
container,
|
|
63
|
+
chartType,
|
|
64
|
+
() => props.data,
|
|
65
|
+
() => propsToOptions(props)
|
|
66
|
+
);
|
|
67
|
+
expose({ getInstance });
|
|
68
|
+
return () => h("div", { ref: container });
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
var LineChart = createVueChart(lineChartType, "LineChart");
|
|
73
|
+
var BarChart = createVueChart(barChartType, "BarChart");
|
|
74
|
+
var StackedBarChart = createVueChart(stackedBarChartType, "StackedBarChart");
|
|
75
|
+
var HorizontalBarChart = createVueChart(horizontalBarChartType, "HorizontalBarChart");
|
|
76
|
+
var PieChart = createVueChart(pieChartType, "PieChart");
|
|
77
|
+
var DonutChart = createVueChart(donutChartType, "DonutChart");
|
|
78
|
+
var ScatterChart = createVueChart(scatterChartType, "ScatterChart");
|
|
79
|
+
var SparklineChart = createVueChart(sparklineChartType, "SparklineChart");
|
|
80
|
+
var AreaChart = createVueChart(areaChartType, "AreaChart");
|
|
81
|
+
var RadarChart = createVueChart(radarChartType, "RadarChart");
|
|
82
|
+
var BubbleChart = createVueChart(bubbleChartType, "BubbleChart");
|
|
83
|
+
var CandlestickChart = createVueChart(candlestickChartType, "CandlestickChart");
|
|
84
|
+
var GaugeChart = createVueChart(gaugeChartType, "GaugeChart");
|
|
85
|
+
var WaterfallChart = createVueChart(waterfallChartType, "WaterfallChart");
|
|
86
|
+
var FunnelChart = createVueChart(funnelChartType, "FunnelChart");
|
|
87
|
+
var HeatmapChart = createVueChart(heatmapChartType, "HeatmapChart");
|
|
88
|
+
var BoxplotChart = createVueChart(boxplotChartType, "BoxplotChart");
|
|
89
|
+
var HistogramChart = createVueChart(histogramChartType, "HistogramChart");
|
|
90
|
+
var TreemapChart = createVueChart(treemapChartType, "TreemapChart");
|
|
91
|
+
var PolarChart = createVueChart(polarChartType, "PolarChart");
|
|
92
|
+
var RadialBarChart = createVueChart(radialBarChartType, "RadialBarChart");
|
|
93
|
+
var LollipopChart = createVueChart(lollipopChartType, "LollipopChart");
|
|
94
|
+
var BulletChart = createVueChart(bulletChartType, "BulletChart");
|
|
95
|
+
var DumbbellChart = createVueChart(dumbbellChartType, "DumbbellChart");
|
|
96
|
+
var CalendarChart = createVueChart(calendarChartType, "CalendarChart");
|
|
97
|
+
var ComboChart = createVueChart(comboChartType, "ComboChart");
|
|
98
|
+
var SankeyChart = createVueChart(sankeyChartType, "SankeyChart");
|
|
99
|
+
var SunburstChart = createVueChart(sunburstChartType, "SunburstChart");
|
|
100
|
+
var TreeChart = createVueChart(treeChartType, "TreeChart");
|
|
101
|
+
var GraphChart = createVueChart(graphChartType, "GraphChart");
|
|
102
|
+
var ParallelChart = createVueChart(parallelChartType, "ParallelChart");
|
|
103
|
+
var ThemeRiverChart = createVueChart(themeRiverChartType, "ThemeRiverChart");
|
|
104
|
+
var PictorialBarChart = createVueChart(pictorialBarChartType, "PictorialBarChart");
|
|
105
|
+
var ChordChart = createVueChart(chordChartType, "ChordChart");
|
|
106
|
+
var GeoChart = createVueChart(geoChartType, "GeoChart");
|
|
107
|
+
var LinesChart = createVueChart(linesChartType, "LinesChart");
|
|
108
|
+
var MatrixChart = createVueChart(matrixChartType, "MatrixChart");
|
|
109
|
+
var CustomChart = createVueChart(customChartType, "CustomChart");
|
|
110
|
+
var OHLCChart = createVueChart(ohlcChartType, "OHLCChart");
|
|
111
|
+
var StepChart = createVueChart(stepChartType, "StepChart");
|
|
112
|
+
var VolumeChart = createVueChart(volumeChartType, "VolumeChart");
|
|
113
|
+
var RangeChart = createVueChart(rangeChartType, "RangeChart");
|
|
114
|
+
var BaselineChart = createVueChart(baselineChartType, "BaselineChart");
|
|
115
|
+
var KagiChart = createVueChart(kagiChartType, "KagiChart");
|
|
116
|
+
var RenkoChart = createVueChart(renkoChartType, "RenkoChart");
|
|
117
|
+
|
|
118
|
+
export { AreaChart, BarChart, BaselineChart, BoxplotChart, BubbleChart, BulletChart, CalendarChart, CandlestickChart, ChordChart, ComboChart, CustomChart, DonutChart, DumbbellChart, FunnelChart, GaugeChart, GeoChart, GraphChart, HeatmapChart, HistogramChart, HorizontalBarChart, KagiChart, LineChart, LinesChart, LollipopChart, MatrixChart, OHLCChart, ParallelChart, PictorialBarChart, PieChart, PolarChart, RadarChart, RadialBarChart, RangeChart, RenkoChart, SankeyChart, ScatterChart, SparklineChart, StackedBarChart, StepChart, SunburstChart, ThemeRiverChart, TreeChart, TreemapChart, VolumeChart, WaterfallChart };
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
|
120
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAyBA,SAAS,QAAA,CACP,YAAA,EACA,SAAA,EACA,OAAA,EACA,UAAA,EACA;AACA,EAAA,IAAI,QAAA,GAAiC,IAAA;AAErC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,aAAa,KAAA,EAAO;AACzB,IAAA,QAAA,GAAW,YAAY,YAAA,CAAa,KAAA,EAAO,WAAW,OAAA,EAAQ,EAAG,YAAY,CAAA;AAAA,EAC/E,CAAC,CAAA;AAED,EAAA,KAAA,CAAM,OAAA,EAAS,CAAC,IAAA,KAAS;AACvB,IAAA,QAAA,EAAU,QAAQ,IAAI,CAAA;AAAA,EACxB,CAAA,EAAG,EAAE,IAAA,EAAM,IAAA,EAAM,CAAA;AAEjB,EAAA,KAAA,CAAM,UAAA,EAAY,CAAC,IAAA,KAAS;AAC1B,IAAA,QAAA,EAAU,WAAW,IAAI,CAAA;AAAA,EAC3B,CAAA,EAAG,EAAE,IAAA,EAAM,IAAA,EAAM,CAAA;AAEjB,EAAA,WAA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onMounted, onUnmounted, watch, h,\n type PropType,\n} from 'vue'\nimport {\n createChart,\n lineChartType, barChartType, stackedBarChartType, horizontalBarChartType,\n pieChartType, donutChartType, scatterChartType, sparklineChartType,\n areaChartType, radarChartType, bubbleChartType, candlestickChartType,\n gaugeChartType, waterfallChartType, funnelChartType, heatmapChartType,\n boxplotChartType, histogramChartType, treemapChartType, polarChartType,\n radialBarChartType, lollipopChartType, bulletChartType, dumbbellChartType,\n calendarChartType, comboChartType, sankeyChartType,\n sunburstChartType, treeChartType, graphChartType, parallelChartType,\n themeRiverChartType, pictorialBarChartType, chordChartType,\n geoChartType, linesChartType, matrixChartType, customChartType,\n ohlcChartType, stepChartType, volumeChartType, rangeChartType,\n baselineChartType, kagiChartType, renkoChartType,\n type ChartData, type ChartOptions, type ChartInstance, type ChartTypePlugin,\n} from '@chartts/core'\n\n// ---------------------------------------------------------------------------\n// Shared composable\n// ---------------------------------------------------------------------------\n\nfunction useChart(\n containerRef: ReturnType<typeof ref<HTMLDivElement | undefined>>,\n chartType: ChartTypePlugin,\n getData: () => ChartData,\n getOptions: () => ChartOptions,\n) {\n let instance: ChartInstance | null = null\n\n onMounted(() => {\n if (!containerRef.value) return\n instance = createChart(containerRef.value, chartType, getData(), getOptions())\n })\n\n watch(getData, (data) => {\n instance?.setData(data)\n }, { deep: true })\n\n watch(getOptions, (opts) => {\n instance?.setOptions(opts)\n }, { deep: true })\n\n onUnmounted(() => {\n instance?.destroy()\n instance = null\n })\n\n return { getInstance: () => instance }\n}\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\nconst chartProps = {\n data: { type: Object as PropType<ChartData>, required: true as const },\n theme: { type: [String, Object] as PropType<ChartOptions['theme']> },\n width: { type: Number },\n height: { type: Number },\n xLabel: { type: String },\n yLabel: { type: String },\n xGrid: { type: Boolean },\n yGrid: { type: Boolean },\n xAxis: { type: Boolean },\n yAxis: { type: Boolean },\n legend: { type: [Boolean, String] as PropType<ChartOptions['legend']> },\n tooltip: { type: [Boolean, Object] as PropType<ChartOptions['tooltip']> },\n animate: { type: Boolean },\n colors: { type: Array as PropType<string[]> },\n curve: { type: String as PropType<ChartOptions['curve']> },\n barRadius: { type: Number },\n barGap: { type: Number },\n yMin: { type: Number },\n yMax: { type: Number },\n ariaLabel: { type: String },\n}\n\nfunction propsToOptions(props: Record<string, unknown>): ChartOptions {\n const opts: ChartOptions = {}\n const skip = new Set(['data', 'class', 'style'])\n for (const [key, value] of Object.entries(props)) {\n if (skip.has(key) || value === undefined) continue\n ;(opts as Record<string, unknown>)[key] = value\n }\n return opts\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nfunction createVueChart(chartType: ChartTypePlugin, name: string) {\n return defineComponent({\n name,\n props: chartProps,\n setup(props, { expose }) {\n const container = ref<HTMLDivElement>()\n const { getInstance } = useChart(\n container,\n chartType,\n () => props.data!,\n () => propsToOptions(props),\n )\n expose({ getInstance })\n return () => h('div', { ref: container })\n },\n })\n}\n\n// ---------------------------------------------------------------------------\n// Chart components — one per chart type\n// ---------------------------------------------------------------------------\n\nexport const LineChart = createVueChart(lineChartType, 'LineChart')\nexport const BarChart = createVueChart(barChartType, 'BarChart')\nexport const StackedBarChart = createVueChart(stackedBarChartType, 'StackedBarChart')\nexport const HorizontalBarChart = createVueChart(horizontalBarChartType, 'HorizontalBarChart')\nexport const PieChart = createVueChart(pieChartType, 'PieChart')\nexport const DonutChart = createVueChart(donutChartType, 'DonutChart')\nexport const ScatterChart = createVueChart(scatterChartType, 'ScatterChart')\nexport const SparklineChart = createVueChart(sparklineChartType, 'SparklineChart')\nexport const AreaChart = createVueChart(areaChartType, 'AreaChart')\nexport const RadarChart = createVueChart(radarChartType, 'RadarChart')\nexport const BubbleChart = createVueChart(bubbleChartType, 'BubbleChart')\nexport const CandlestickChart = createVueChart(candlestickChartType, 'CandlestickChart')\nexport const GaugeChart = createVueChart(gaugeChartType, 'GaugeChart')\nexport const WaterfallChart = createVueChart(waterfallChartType, 'WaterfallChart')\nexport const FunnelChart = createVueChart(funnelChartType, 'FunnelChart')\nexport const HeatmapChart = createVueChart(heatmapChartType, 'HeatmapChart')\nexport const BoxplotChart = createVueChart(boxplotChartType, 'BoxplotChart')\nexport const HistogramChart = createVueChart(histogramChartType, 'HistogramChart')\nexport const TreemapChart = createVueChart(treemapChartType, 'TreemapChart')\nexport const PolarChart = createVueChart(polarChartType, 'PolarChart')\nexport const RadialBarChart = createVueChart(radialBarChartType, 'RadialBarChart')\nexport const LollipopChart = createVueChart(lollipopChartType, 'LollipopChart')\nexport const BulletChart = createVueChart(bulletChartType, 'BulletChart')\nexport const DumbbellChart = createVueChart(dumbbellChartType, 'DumbbellChart')\nexport const CalendarChart = createVueChart(calendarChartType, 'CalendarChart')\nexport const ComboChart = createVueChart(comboChartType, 'ComboChart')\nexport const SankeyChart = createVueChart(sankeyChartType, 'SankeyChart')\nexport const SunburstChart = createVueChart(sunburstChartType, 'SunburstChart')\nexport const TreeChart = createVueChart(treeChartType, 'TreeChart')\nexport const GraphChart = createVueChart(graphChartType, 'GraphChart')\nexport const ParallelChart = createVueChart(parallelChartType, 'ParallelChart')\nexport const ThemeRiverChart = createVueChart(themeRiverChartType, 'ThemeRiverChart')\nexport const PictorialBarChart = createVueChart(pictorialBarChartType, 'PictorialBarChart')\nexport const ChordChart = createVueChart(chordChartType, 'ChordChart')\nexport const GeoChart = createVueChart(geoChartType, 'GeoChart')\nexport const LinesChart = createVueChart(linesChartType, 'LinesChart')\nexport const MatrixChart = createVueChart(matrixChartType, 'MatrixChart')\nexport const CustomChart = createVueChart(customChartType, 'CustomChart')\nexport const OHLCChart = createVueChart(ohlcChartType, 'OHLCChart')\nexport const StepChart = createVueChart(stepChartType, 'StepChart')\nexport const VolumeChart = createVueChart(volumeChartType, 'VolumeChart')\nexport const RangeChart = createVueChart(rangeChartType, 'RangeChart')\nexport const BaselineChart = createVueChart(baselineChartType, 'BaselineChart')\nexport const KagiChart = createVueChart(kagiChartType, 'KagiChart')\nexport const RenkoChart = createVueChart(renkoChartType, 'RenkoChart')\n\n// ---------------------------------------------------------------------------\n// Re-exports\n// ---------------------------------------------------------------------------\n\nexport {\n lineChartType, barChartType, stackedBarChartType, horizontalBarChartType,\n pieChartType, donutChartType, scatterChartType, sparklineChartType,\n areaChartType, radarChartType, bubbleChartType, candlestickChartType,\n gaugeChartType, waterfallChartType, funnelChartType, heatmapChartType,\n boxplotChartType, histogramChartType, treemapChartType, polarChartType,\n radialBarChartType, lollipopChartType, bulletChartType, dumbbellChartType,\n calendarChartType, comboChartType, sankeyChartType,\n sunburstChartType, treeChartType, graphChartType, parallelChartType,\n themeRiverChartType, pictorialBarChartType, chordChartType,\n geoChartType, linesChartType, matrixChartType, customChartType,\n ohlcChartType, stepChartType, volumeChartType, rangeChartType,\n baselineChartType, kagiChartType, renkoChartType,\n} from '@chartts/core'\nexport type { ChartData, ChartOptions, ChartInstance, ChartTypePlugin } from '@chartts/core'\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@chartts/vue",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Chartts Vue components — native, not a wrapper.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"vue": ">=3.3.0",
|
|
22
|
+
"@chartts/core": "0.1.3"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/chartts/chartts"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://chartts.com",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsup",
|
|
32
|
+
"dev": "tsup --watch"
|
|
33
|
+
}
|
|
34
|
+
}
|