vue-chrts 0.2.0-test.5 → 0.2.0-test.7

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.
Files changed (34) hide show
  1. package/dist/components/AreaChart/AreaChart.vue.d.ts +4 -2
  2. package/dist/components/AreaChart/types.d.ts +20 -2
  3. package/dist/components/AreaStackedChart/types.d.ts +18 -0
  4. package/dist/components/BarChart/BarChart.vue.d.ts +5 -3
  5. package/dist/components/BarChart/stackedGroupedUtils.d.ts +19 -0
  6. package/dist/components/BarChart/types.d.ts +41 -22
  7. package/dist/components/DonutChart/DonutChart.vue.d.ts +4 -2
  8. package/dist/components/DonutChart/types.d.ts +7 -3
  9. package/dist/components/LineChart/LineChart.vue.d.ts +4 -2
  10. package/dist/components/LineChart/types.d.ts +24 -5
  11. package/dist/components/Tooltip.vue.d.ts +3 -2
  12. package/dist/index.d.ts +2 -3
  13. package/dist/index.js.js +753 -0
  14. package/dist/types.d.ts +6 -43
  15. package/dist/utils.d.ts +4 -1
  16. package/package.json +14 -15
  17. package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
  18. package/dist/components/AreaChart/AreaChart.js +0 -6
  19. package/dist/components/AreaChart/AreaChart2.js +0 -163
  20. package/dist/components/AreaStackedChart/AreaStackedChart.js +0 -80
  21. package/dist/components/AreaStackedChart/AreaStackedChart2.js +0 -4
  22. package/dist/components/BarChart/BarChart.js +0 -192
  23. package/dist/components/BarChart/BarChart2.js +0 -4
  24. package/dist/components/DonutChart/DonutChart.js +0 -77
  25. package/dist/components/DonutChart/DonutChart2.js +0 -4
  26. package/dist/components/DonutChart/types.js +0 -4
  27. package/dist/components/LineChart/LineChart.js +0 -142
  28. package/dist/components/LineChart/LineChart2.js +0 -4
  29. package/dist/components/Tooltip.js +0 -48
  30. package/dist/components/Tooltip2.js +0 -4
  31. package/dist/index.js +0 -16
  32. package/dist/index.js.css +0 -1
  33. package/dist/types.js +0 -6
  34. package/dist/utils.js +0 -34
@@ -1,6 +1,8 @@
1
1
  import { AreaChartProps } from './types';
2
2
  declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & AreaChartProps<T> & Partial<{}>> & import('vue').PublicProps;
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
+ readonly onClick?: ((event: MouseEvent, values?: T | undefined) => any) | undefined;
5
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & AreaChartProps<T> & Partial<{}>> & import('vue').PublicProps;
4
6
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
7
  attrs: any;
6
8
  slots: {
@@ -9,7 +11,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
9
11
  }): any;
10
12
  fallback?(_: {}): any;
11
13
  };
12
- emit: {};
14
+ emit: (e: "click", event: MouseEvent, values?: T) => void;
13
15
  }>) => import('vue').VNode & {
14
16
  __ctx?: Awaited<typeof __VLS_setup>;
15
17
  };
@@ -44,14 +44,14 @@ export interface AreaChartProps<T> {
44
44
  * @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
45
45
  * @returns {string} The formatted string representation of the tick.
46
46
  */
47
- xFormatter?: axisFormatter<T>;
47
+ xFormatter?: axisFormatter;
48
48
  /**
49
49
  * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the y-axis.
50
50
  * @param {number} i - The index of the tick in the `ticks` array.
51
51
  * @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
52
52
  * @returns {string} The formatted string representation of the tick.
53
53
  */
54
- yFormatter?: axisFormatter<T>;
54
+ yFormatter?: axisFormatter;
55
55
  /**
56
56
  * The type of curve to use for the area chart lines.
57
57
  * See `CurveType` for available options.
@@ -126,4 +126,22 @@ export interface AreaChartProps<T> {
126
126
  * If `true`, hide the y-axis.
127
127
  */
128
128
  hideYAxis?: boolean;
129
+ /**
130
+ * Crosshair configuration object for customizing the appearance of the crosshair line.
131
+ */
132
+ crosshairConfig?: {
133
+ /**
134
+ * The color of the crosshair line. Accepts any valid CSS color string.
135
+ * Example: '#f00', 'rgba(0,0,0,0.5)', 'blue'
136
+ */
137
+ color?: string;
138
+ /**
139
+ * The stroke color of the crosshair line. Accepts any valid CSS color string.
140
+ */
141
+ strokeColor?: string;
142
+ /**
143
+ * The stroke width of the crosshair line in pixels.
144
+ */
145
+ strokeWidth?: number;
146
+ };
129
147
  }
@@ -65,4 +65,22 @@ export interface AreaStackedChartProps<T> {
65
65
  * If `true`, displays tick lines on the y-axis.
66
66
  */
67
67
  yTickLine?: boolean;
68
+ /**
69
+ * Crosshair configuration object for customizing the appearance of the crosshair line.
70
+ */
71
+ crosshairConfig?: {
72
+ /**
73
+ * The color of the crosshair line. Accepts any valid CSS color string.
74
+ * Example: '#f00', 'rgba(0,0,0,0.5)', 'blue'
75
+ */
76
+ color?: string;
77
+ /**
78
+ * The stroke color of the crosshair line. Accepts any valid CSS color string.
79
+ */
80
+ strokeColor?: string;
81
+ /**
82
+ * The stroke width of the crosshair line in pixels.
83
+ */
84
+ strokeWidth?: number;
85
+ };
68
86
  }
@@ -1,15 +1,17 @@
1
1
  import { BarChartProps } from './types';
2
2
  declare const _default: <T extends {}>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & BarChartProps<T> & Partial<{}>> & import('vue').PublicProps;
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
+ readonly onClick?: ((event: MouseEvent, values?: T | undefined) => any) | undefined;
5
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & BarChartProps<T> & Partial<{}>> & import('vue').PublicProps;
4
6
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
7
  attrs: any;
6
8
  slots: {
7
9
  tooltip?(_: {
8
- values: T | undefined;
10
+ values: any;
9
11
  }): any;
10
12
  fallback?(_: {}): any;
11
13
  };
12
- emit: {};
14
+ emit: (e: "click", event: MouseEvent, values?: T) => void;
13
15
  }>) => import('vue').VNode & {
14
16
  __ctx?: Awaited<typeof __VLS_setup>;
15
17
  };
@@ -0,0 +1,19 @@
1
+ import { ComputedRef } from 'vue';
2
+ export interface StackedGroupedConfig<T> {
3
+ data: T[];
4
+ categories: Record<string, {
5
+ color?: string;
6
+ }>;
7
+ stackAndGrouped: boolean;
8
+ xAxis?: keyof T;
9
+ }
10
+ export interface StackedGroupedResult<T> {
11
+ states: string[];
12
+ groupedByState: Record<string, string[]>;
13
+ colors: Record<string, string[]>;
14
+ bars: Record<string, ((d: any) => any)[]>;
15
+ colorFunctions: Record<string, (d: unknown, i: number) => string>;
16
+ positions: Record<string, number>;
17
+ chartData: T[] | any[];
18
+ }
19
+ export declare function useStackedGrouped<T extends {}>(config: StackedGroupedConfig<T>): ComputedRef<StackedGroupedResult<T>>;
@@ -1,5 +1,6 @@
1
- import { BulletLegendItemInterface, Orientation, LegendPosition, axisFormatter } from '../../types';
2
- export interface BarChartProps<T> {
1
+ import { BulletLegendItemInterface, Orientation } from '@unovis/ts';
2
+ import { LegendPosition, axisFormatter } from '../../types';
3
+ type BarChartPropsBase<T> = {
3
4
  /**
4
5
  * The data to be displayed in the bar chart.
5
6
  * Each element of the array represents a data point.
@@ -10,10 +11,6 @@ export interface BarChartProps<T> {
10
11
  * If `true`, creates a stacked bar chart instead of grouped bars.
11
12
  */
12
13
  stacked?: boolean;
13
- /**
14
- * If `true`, creates a combination of stacked and grouped bar charts.
15
- */
16
- stackAndGrouped?: boolean;
17
14
  /**
18
15
  * The height of the chart in pixels.
19
16
  */
@@ -27,9 +24,9 @@ export interface BarChartProps<T> {
27
24
  */
28
25
  yLabel?: string;
29
26
  /**
30
- * Optional padding applied to the chart.
31
- * Allows specifying individual padding values for the top, right, bottom, and left sides.
32
- */
27
+ * Optional padding applied to the chart.
28
+ * Allows specifying individual padding values for the top, right, bottom, and left sides.
29
+ */
33
30
  padding?: {
34
31
  top: number;
35
32
  right: number;
@@ -42,19 +39,19 @@ export interface BarChartProps<T> {
42
39
  */
43
40
  categories: Record<string, BulletLegendItemInterface>;
44
41
  /**
45
- * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the x-axis.
46
- * @param {number} i - The index of the tick in the `ticks` array.
47
- * @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
48
- * @returns {string} The formatted string representation of the tick.
49
- */
50
- xFormatter?: axisFormatter<T>;
42
+ * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the x-axis.
43
+ * @param {number} i - The index of the tick in the `ticks` array.
44
+ * @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
45
+ * @returns {string} The formatted string representation of the tick.
46
+ */
47
+ xFormatter?: axisFormatter;
51
48
  /**
52
- * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the y-axis.
53
- * @param {number} i - The index of the tick in the `ticks` array.
54
- * @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
55
- * @returns {string} The formatted string representation of the tick.
56
- */
57
- yFormatter?: axisFormatter<T>;
49
+ * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the y-axis.
50
+ * @param {number} i - The index of the tick in the `ticks` array.
51
+ * @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
52
+ * @returns {string} The formatted string representation of the tick.
53
+ */
54
+ yFormatter?: axisFormatter;
58
55
  /**
59
56
  * The desired number of ticks on the y-axis.
60
57
  */
@@ -91,6 +88,10 @@ export interface BarChartProps<T> {
91
88
  * If `true`, hides the chart legend.
92
89
  */
93
90
  hideLegend?: boolean;
91
+ /**
92
+ * If `true`, hides the chart tooltip.
93
+ */
94
+ hideTooltip?: boolean;
94
95
  /**
95
96
  * The orientation of the bars (vertical or horizontal).
96
97
  * See `Orientation` for available options.
@@ -133,4 +134,22 @@ export interface BarChartProps<T> {
133
134
  * If `true`, hide the y-axis.
134
135
  */
135
136
  hideYAxis?: boolean;
136
- }
137
+ };
138
+ type BarChartPropsStackAndGrouped<T> = BarChartPropsBase<T> & {
139
+ stackAndGrouped: true;
140
+ /**
141
+ * The key in the data object type 'T' to be used for the x-axis values.
142
+ * Required when stackAndGrouped is true.
143
+ */
144
+ xAxis: keyof T;
145
+ };
146
+ type BarChartPropsNormal<T> = BarChartPropsBase<T> & {
147
+ stackAndGrouped?: false;
148
+ /**
149
+ * The key in the data object type 'T' to be used for the x-axis values.
150
+ * Optional when stackAndGrouped is not true.
151
+ */
152
+ xAxis?: keyof T;
153
+ };
154
+ export type BarChartProps<T> = BarChartPropsStackAndGrouped<T> | BarChartPropsNormal<T>;
155
+ export {};
@@ -1,6 +1,8 @@
1
1
  import { DonutChartProps } from './types';
2
2
  declare const _default: <T extends {}>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & DonutChartProps & Partial<{}>> & import('vue').PublicProps;
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
+ readonly onClick?: ((event: MouseEvent, values?: any) => any) | undefined;
5
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & DonutChartProps & Partial<{}>> & import('vue').PublicProps;
4
6
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
7
  attrs: any;
6
8
  slots: {
@@ -10,7 +12,7 @@ declare const _default: <T extends {}>(__VLS_props: NonNullable<Awaited<typeof _
10
12
  }): any;
11
13
  fallback?(_: {}): any;
12
14
  };
13
- emit: {};
15
+ emit: (e: "click", event: MouseEvent, values?: any) => void;
14
16
  }>) => import('vue').VNode & {
15
17
  __ctx?: Awaited<typeof __VLS_setup>;
16
18
  };
@@ -1,4 +1,4 @@
1
- interface DonutChartProps {
1
+ export type DonutChartProps = {
2
2
  /**
3
3
  * The type of donut chart to render.
4
4
  * See `DonutType` for available options.
@@ -28,9 +28,13 @@ interface DonutChartProps {
28
28
  name: string;
29
29
  color: string;
30
30
  }[];
31
- }
31
+ /**
32
+ * Pad angle. Default: 0
33
+ */
34
+ padAngle?: number;
35
+ };
32
36
  declare enum DonutType {
33
37
  Half = "half",
34
38
  Full = "full"
35
39
  }
36
- export { type DonutChartProps, DonutType };
40
+ export { DonutType };
@@ -1,6 +1,8 @@
1
1
  import { LineChartProps } from './types';
2
2
  declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & LineChartProps<T> & Partial<{}>> & import('vue').PublicProps;
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
+ readonly onClick?: ((event: MouseEvent, values?: T | undefined) => any) | undefined;
5
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & LineChartProps<T> & Partial<{}>> & import('vue').PublicProps;
4
6
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
7
  attrs: any;
6
8
  slots: {
@@ -9,7 +11,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
9
11
  }): any;
10
12
  fallback?(_: {}): any;
11
13
  };
12
- emit: {};
14
+ emit: (e: "click", event: MouseEvent, values?: T) => void;
13
15
  }>) => import('vue').VNode & {
14
16
  __ctx?: Awaited<typeof __VLS_setup>;
15
17
  };
@@ -1,4 +1,5 @@
1
- import { axisFormatter, BulletLegendItemInterface, CurveType, LegendPosition, MarkerConfig } from '../../types';
1
+ import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
2
+ import { axisFormatter, LegendPosition, MarkerConfig } from '../../types';
2
3
  export interface LineChartProps<T> {
3
4
  /**
4
5
  * The data to be displayed in the line chart.
@@ -43,22 +44,22 @@ export interface LineChartProps<T> {
43
44
  * @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
44
45
  * @returns {string} The formatted string representation of the tick.
45
46
  */
46
- xFormatter?: axisFormatter<T>;
47
+ xFormatter?: axisFormatter;
47
48
  /**
48
49
  * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the y-axis.
49
50
  * @param {number} i - The index of the tick in the `ticks` array.
50
51
  * @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
51
52
  * @returns {string} The formatted string representation of the tick.
52
53
  */
53
- yFormatter?: axisFormatter<T>;
54
+ yFormatter?: axisFormatter;
54
55
  /**
55
56
  * The type of curve to use for the line chart.
56
57
  * See `CurveType` for available options.
57
58
  */
58
59
  curveType?: CurveType;
59
60
  /**
60
- * The width of the line in pixels. Default is 2px.
61
- */
61
+ * The width of the line in pixels. Default is 2px.
62
+ */
62
63
  lineWidth?: number;
63
64
  /**
64
65
  * Line dash array, see SVG's stroke-dasharray. Default: `undefined`
@@ -125,4 +126,22 @@ export interface LineChartProps<T> {
125
126
  * If `true`, hide the y-axis.
126
127
  */
127
128
  hideYAxis?: boolean;
129
+ /**
130
+ * Crosshair configuration object for customizing the appearance of the crosshair line.
131
+ */
132
+ crosshairConfig?: {
133
+ /**
134
+ * The color of the crosshair line. Accepts any valid CSS color string.
135
+ * Example: '#f00', 'rgba(0,0,0,0.5)', 'blue'
136
+ */
137
+ color?: string;
138
+ /**
139
+ * The stroke color of the crosshair line. Accepts any valid CSS color string.
140
+ */
141
+ strokeColor?: string;
142
+ /**
143
+ * The stroke width of the crosshair line in pixels.
144
+ */
145
+ strokeWidth?: number;
146
+ };
128
147
  }
@@ -1,10 +1,11 @@
1
- import { axisFormatter, BulletLegendItemInterface } from '../types';
1
+ import { axisFormatter } from '../types';
2
+ import { BulletLegendItemInterface } from '@unovis/ts';
2
3
  declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
4
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
4
5
  data: T;
5
6
  categories: Record<string, BulletLegendItemInterface>;
6
7
  toolTipTitle: string | number;
7
- yFormatter?: axisFormatter<T>;
8
+ yFormatter?: axisFormatter;
8
9
  } & Partial<{}>> & import('vue').PublicProps;
9
10
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
10
11
  attrs: any;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,5 @@ import { default as AreaStackedChart } from './components/AreaStackedChart/AreaS
3
3
  import { default as LineChart } from './components/LineChart/LineChart.vue';
4
4
  import { default as BarChart } from './components/BarChart/BarChart.vue';
5
5
  import { default as DonutChart } from './components/DonutChart/DonutChart.vue';
6
- import { LegendPosition, CurveType, Orientation, BulletLegendItemInterface } from './types';
7
- export { AreaChart, AreaStackedChart, LineChart, BarChart, DonutChart, Orientation, CurveType, LegendPosition };
8
- export type { BulletLegendItemInterface, };
6
+ import { LegendPosition } from './types';
7
+ export { AreaChart, AreaStackedChart, LineChart, BarChart, DonutChart, LegendPosition };