Skip to content

Commit d143bb0

Browse files
authored
fix: correct chart tooltip jsdocs comment and showGradient prop typo
1 parent 5a09fcf commit d143bb0

File tree

30 files changed

+48
-48
lines changed

30 files changed

+48
-48
lines changed

apps/v4/registry/new-york-v4/ui/chart-area/AreaChart.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const props = withDefaults(defineProps<BaseChartProps<T> & {
2424
* Controls the visibility of gradient.
2525
* @default true
2626
*/
27-
showGradiant?: boolean
27+
showGradient?: boolean
2828
}>(), {
2929
curveType: CurveType.MonotoneX,
3030
filterOpacity: 0.2,
@@ -34,7 +34,7 @@ const props = withDefaults(defineProps<BaseChartProps<T> & {
3434
showTooltip: true,
3535
showLegend: true,
3636
showGridLine: true,
37-
showGradiant: true,
37+
showGradient: true,
3838
})
3939
4040
const emits = defineEmits<{
@@ -70,7 +70,7 @@ function handleLegendItemClick(d: BulletLegendItemInterface, i: number) {
7070
<svg width="0" height="0">
7171
<defs>
7272
<linearGradient v-for="(color, i) in colors" :id="`${chartRef}-color-${i}`" :key="i" x1="0" y1="0" x2="0" y2="1">
73-
<template v-if="showGradiant">
73+
<template v-if="showGradient">
7474
<stop offset="5%" :stop-color="color" stop-opacity="0.4" />
7575
<stop offset="95%" :stop-color="color" stop-opacity="0" />
7676
</template>

apps/v4/registry/new-york-v4/ui/chart-area/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface BaseChartProps<T extends Record<string, any>> {
1010
*/
1111
data: T[]
1212
/**
13-
* Select the categories from your data. Used to populate the legend and toolip.
13+
* Select the categories from your data. Used to populate the legend and tooltip.
1414
*/
1515
categories: KeyOf<T>[]
1616
/**

apps/v4/registry/new-york-v4/ui/chart-bar/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface BaseChartProps<T extends Record<string, any>> {
1010
*/
1111
data: T[]
1212
/**
13-
* Select the categories from your data. Used to populate the legend and toolip.
13+
* Select the categories from your data. Used to populate the legend and tooltip.
1414
*/
1515
categories: KeyOf<T>[]
1616
/**

apps/v4/registry/new-york-v4/ui/chart-line/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface BaseChartProps<T extends Record<string, any>> {
1010
*/
1111
data: T[]
1212
/**
13-
* Select the categories from your data. Used to populate the legend and toolip.
13+
* Select the categories from your data. Used to populate the legend and tooltip.
1414
*/
1515
categories: KeyOf<T>[]
1616
/**

apps/v4/registry/new-york-v4/ui/chart/interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface BaseChartProps<T extends Record<string, any>> {
88
*/
99
data: T[]
1010
/**
11-
* Select the categories from your data. Used to populate the legend and toolip.
11+
* Select the categories from your data. Used to populate the legend and tooltip.
1212
*/
1313
categories: KeyOf<T>[]
1414
/**

apps/www/src/content/meta/AreaChart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
'name': 'categories',
12-
'description': '<p>Select the categories from your data. Used to populate the legend and toolip.</p>\n',
12+
'description': '<p>Select the categories from your data. Used to populate the legend and tooltip.</p>\n',
1313
'type': 'string[]',
1414
'required': true
1515
},
@@ -100,7 +100,7 @@
100100
'default': 'CurveType.MonotoneX'
101101
},
102102
{
103-
'name': 'showGradiant',
103+
'name': 'showGradient',
104104
'description': '<p>Controls the visibility of gradient.</p>\n',
105105
'type': 'boolean',
106106
'required': false,

apps/www/src/content/meta/BarChart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
'name': 'categories',
12-
'description': '<p>Select the categories from your data. Used to populate the legend and toolip.</p>\n',
12+
'description': '<p>Select the categories from your data. Used to populate the legend and tooltip.</p>\n',
1313
'type': 'string[]',
1414
'required': true
1515
},

apps/www/src/content/meta/LineChart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
'name': 'categories',
12-
'description': '<p>Select the categories from your data. Used to populate the legend and toolip.</p>\n',
12+
'description': '<p>Select the categories from your data. Used to populate the legend and tooltip.</p>\n',
1313
'type': 'string[]',
1414
'required': true
1515
},

apps/www/src/public/r/styles/default/chart-area.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
"files": [
1414
{
1515
"path": "ui/chart-area/AreaChart.vue",
16-
"content": "<script setup lang=\"ts\" generic=\"T extends Record<string, any>\">\r\nimport type { BulletLegendItemInterface } from \"@unovis/ts\"\r\nimport type { Component } from \"vue\"\r\nimport type { BaseChartProps } from \".\"\r\nimport { Area, Axis, CurveType, Line } from \"@unovis/ts\"\r\n\r\nimport { VisArea, VisAxis, VisLine, VisXYContainer } from \"@unovis/vue\"\r\nimport { useMounted } from \"@vueuse/core\"\r\nimport { useId } from \"reka-ui\"\r\nimport { computed, ref } from \"vue\"\r\nimport { cn } from \"@/lib/utils\"\r\nimport { ChartCrosshair, ChartLegend, defaultColors } from \"@/registry/default/ui/chart\"\r\n\r\nconst props = withDefaults(defineProps<BaseChartProps<T> & {\r\n /**\r\n * Render custom tooltip component.\r\n */\r\n customTooltip?: Component\r\n /**\r\n * Type of curve\r\n */\r\n curveType?: CurveType\r\n /**\r\n * Controls the visibility of gradient.\r\n * @default true\r\n */\r\n showGradiant?: boolean\r\n}>(), {\r\n curveType: CurveType.MonotoneX,\r\n filterOpacity: 0.2,\r\n margin: () => ({ top: 0, bottom: 0, left: 0, right: 0 }),\r\n showXAxis: true,\r\n showYAxis: true,\r\n showTooltip: true,\r\n showLegend: true,\r\n showGridLine: true,\r\n showGradiant: true,\r\n})\r\n\r\nconst emits = defineEmits<{\r\n legendItemClick: [d: BulletLegendItemInterface, i: number]\r\n}>()\r\n\r\ntype KeyOfT = Extract<keyof T, string>\r\ntype Data = typeof props.data[number]\r\n\r\nconst chartRef = useId()\r\n\r\nconst index = computed(() => props.index as KeyOfT)\r\nconst colors = computed(() => props.colors?.length ? props.colors : defaultColors(props.categories.length))\r\n\r\nconst legendItems = ref<BulletLegendItemInterface[]>(props.categories.map((category, i) => ({\r\n name: category,\r\n color: colors.value[i],\r\n inactive: false,\r\n})))\r\n\r\nconst isMounted = useMounted()\r\n\r\nfunction handleLegendItemClick(d: BulletLegendItemInterface, i: number) {\r\n emits(\"legendItemClick\", d, i)\r\n}\r\n</script>\r\n\r\n<template>\r\n <div :class=\"cn('w-full h-[400px] flex flex-col items-end', $attrs.class ?? '')\">\r\n <ChartLegend v-if=\"showLegend\" v-model:items=\"legendItems\" @legend-item-click=\"handleLegendItemClick\" />\r\n\r\n <VisXYContainer :style=\"{ height: isMounted ? '100%' : 'auto' }\" :margin=\"{ left: 20, right: 20 }\" :data=\"data\">\r\n <svg width=\"0\" height=\"0\">\r\n <defs>\r\n <linearGradient v-for=\"(color, i) in colors\" :id=\"`${chartRef}-color-${i}`\" :key=\"i\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\r\n <template v-if=\"showGradiant\">\r\n <stop offset=\"5%\" :stop-color=\"color\" stop-opacity=\"0.4\" />\r\n <stop offset=\"95%\" :stop-color=\"color\" stop-opacity=\"0\" />\r\n </template>\r\n <template v-else>\r\n <stop offset=\"0%\" :stop-color=\"color\" />\r\n </template>\r\n </linearGradient>\r\n </defs>\r\n </svg>\r\n\r\n <ChartCrosshair v-if=\"showTooltip\" :colors=\"colors\" :items=\"legendItems\" :index=\"index\" :custom-tooltip=\"customTooltip\" />\r\n\r\n <template v-for=\"(category, i) in categories\" :key=\"category\">\r\n <VisArea\r\n :x=\"(d: Data, i: number) => i\"\r\n :y=\"(d: Data) => d[category]\"\r\n color=\"auto\"\r\n :curve-type=\"curveType\"\r\n :attributes=\"{\r\n [Area.selectors.area]: {\r\n fill: `url(#${chartRef}-color-${i})`,\r\n },\r\n }\"\r\n :opacity=\"legendItems.find(item => item.name === category)?.inactive ? filterOpacity : 1\"\r\n />\r\n </template>\r\n\r\n <template v-for=\"(category, i) in categories\" :key=\"category\">\r\n <VisLine\r\n :x=\"(d: Data, i: number) => i\"\r\n :y=\"(d: Data) => d[category]\"\r\n :color=\"colors[i]\"\r\n :curve-type=\"curveType\"\r\n :attributes=\"{\r\n [Line.selectors.line]: {\r\n opacity: legendItems.find(item => item.name === category)?.inactive ? filterOpacity : 1,\r\n },\r\n }\"\r\n />\r\n </template>\r\n\r\n <VisAxis\r\n v-if=\"showXAxis\"\r\n type=\"x\"\r\n :tick-format=\"xFormatter ?? ((v: number) => data[v]?.[index])\"\r\n :grid-line=\"false\"\r\n :tick-line=\"false\"\r\n tick-text-color=\"hsl(var(--vis-text-color))\"\r\n />\r\n <VisAxis\r\n v-if=\"showYAxis\"\r\n type=\"y\"\r\n :tick-line=\"false\"\r\n :tick-format=\"yFormatter\"\r\n :domain-line=\"false\"\r\n :grid-line=\"showGridLine\"\r\n :attributes=\"{\r\n [Axis.selectors.grid]: {\r\n class: 'text-muted',\r\n },\r\n }\"\r\n tick-text-color=\"hsl(var(--vis-text-color))\"\r\n />\r\n\r\n <slot />\r\n </VisXYContainer>\r\n </div>\r\n</template>\r\n",
16+
"content": "<script setup lang=\"ts\" generic=\"T extends Record<string, any>\">\r\nimport type { BulletLegendItemInterface } from \"@unovis/ts\"\r\nimport type { Component } from \"vue\"\r\nimport type { BaseChartProps } from \".\"\r\nimport { Area, Axis, CurveType, Line } from \"@unovis/ts\"\r\n\r\nimport { VisArea, VisAxis, VisLine, VisXYContainer } from \"@unovis/vue\"\r\nimport { useMounted } from \"@vueuse/core\"\r\nimport { useId } from \"reka-ui\"\r\nimport { computed, ref } from \"vue\"\r\nimport { cn } from \"@/lib/utils\"\r\nimport { ChartCrosshair, ChartLegend, defaultColors } from \"@/registry/default/ui/chart\"\r\n\r\nconst props = withDefaults(defineProps<BaseChartProps<T> & {\r\n /**\r\n * Render custom tooltip component.\r\n */\r\n customTooltip?: Component\r\n /**\r\n * Type of curve\r\n */\r\n curveType?: CurveType\r\n /**\r\n * Controls the visibility of gradient.\r\n * @default true\r\n */\r\n showGradient?: boolean\r\n}>(), {\r\n curveType: CurveType.MonotoneX,\r\n filterOpacity: 0.2,\r\n margin: () => ({ top: 0, bottom: 0, left: 0, right: 0 }),\r\n showXAxis: true,\r\n showYAxis: true,\r\n showTooltip: true,\r\n showLegend: true,\r\n showGridLine: true,\r\n showGradient: true,\r\n})\r\n\r\nconst emits = defineEmits<{\r\n legendItemClick: [d: BulletLegendItemInterface, i: number]\r\n}>()\r\n\r\ntype KeyOfT = Extract<keyof T, string>\r\ntype Data = typeof props.data[number]\r\n\r\nconst chartRef = useId()\r\n\r\nconst index = computed(() => props.index as KeyOfT)\r\nconst colors = computed(() => props.colors?.length ? props.colors : defaultColors(props.categories.length))\r\n\r\nconst legendItems = ref<BulletLegendItemInterface[]>(props.categories.map((category, i) => ({\r\n name: category,\r\n color: colors.value[i],\r\n inactive: false,\r\n})))\r\n\r\nconst isMounted = useMounted()\r\n\r\nfunction handleLegendItemClick(d: BulletLegendItemInterface, i: number) {\r\n emits(\"legendItemClick\", d, i)\r\n}\r\n</script>\r\n\r\n<template>\r\n <div :class=\"cn('w-full h-[400px] flex flex-col items-end', $attrs.class ?? '')\">\r\n <ChartLegend v-if=\"showLegend\" v-model:items=\"legendItems\" @legend-item-click=\"handleLegendItemClick\" />\r\n\r\n <VisXYContainer :style=\"{ height: isMounted ? '100%' : 'auto' }\" :margin=\"{ left: 20, right: 20 }\" :data=\"data\">\r\n <svg width=\"0\" height=\"0\">\r\n <defs>\r\n <linearGradient v-for=\"(color, i) in colors\" :id=\"`${chartRef}-color-${i}`\" :key=\"i\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\r\n <template v-if=\"showGradient\">\r\n <stop offset=\"5%\" :stop-color=\"color\" stop-opacity=\"0.4\" />\r\n <stop offset=\"95%\" :stop-color=\"color\" stop-opacity=\"0\" />\r\n </template>\r\n <template v-else>\r\n <stop offset=\"0%\" :stop-color=\"color\" />\r\n </template>\r\n </linearGradient>\r\n </defs>\r\n </svg>\r\n\r\n <ChartCrosshair v-if=\"showTooltip\" :colors=\"colors\" :items=\"legendItems\" :index=\"index\" :custom-tooltip=\"customTooltip\" />\r\n\r\n <template v-for=\"(category, i) in categories\" :key=\"category\">\r\n <VisArea\r\n :x=\"(d: Data, i: number) => i\"\r\n :y=\"(d: Data) => d[category]\"\r\n color=\"auto\"\r\n :curve-type=\"curveType\"\r\n :attributes=\"{\r\n [Area.selectors.area]: {\r\n fill: `url(#${chartRef}-color-${i})`,\r\n },\r\n }\"\r\n :opacity=\"legendItems.find(item => item.name === category)?.inactive ? filterOpacity : 1\"\r\n />\r\n </template>\r\n\r\n <template v-for=\"(category, i) in categories\" :key=\"category\">\r\n <VisLine\r\n :x=\"(d: Data, i: number) => i\"\r\n :y=\"(d: Data) => d[category]\"\r\n :color=\"colors[i]\"\r\n :curve-type=\"curveType\"\r\n :attributes=\"{\r\n [Line.selectors.line]: {\r\n opacity: legendItems.find(item => item.name === category)?.inactive ? filterOpacity : 1,\r\n },\r\n }\"\r\n />\r\n </template>\r\n\r\n <VisAxis\r\n v-if=\"showXAxis\"\r\n type=\"x\"\r\n :tick-format=\"xFormatter ?? ((v: number) => data[v]?.[index])\"\r\n :grid-line=\"false\"\r\n :tick-line=\"false\"\r\n tick-text-color=\"hsl(var(--vis-text-color))\"\r\n />\r\n <VisAxis\r\n v-if=\"showYAxis\"\r\n type=\"y\"\r\n :tick-line=\"false\"\r\n :tick-format=\"yFormatter\"\r\n :domain-line=\"false\"\r\n :grid-line=\"showGridLine\"\r\n :attributes=\"{\r\n [Axis.selectors.grid]: {\r\n class: 'text-muted',\r\n },\r\n }\"\r\n tick-text-color=\"hsl(var(--vis-text-color))\"\r\n />\r\n\r\n <slot />\r\n </VisXYContainer>\r\n </div>\r\n</template>\r\n",
1717
"type": "registry:ui",
1818
"target": ""
1919
},
2020
{
2121
"path": "ui/chart-area/index.ts",
22-
"content": "export { default as AreaChart } from \"./AreaChart.vue\"\r\n\r\nimport type { Spacing } from \"@unovis/ts\"\r\n\r\ntype KeyOf<T extends Record<string, any>> = Extract<keyof T, string>\r\n\r\nexport interface BaseChartProps<T extends Record<string, any>> {\r\n /**\r\n * The source data, in which each entry is a dictionary.\r\n */\r\n data: T[]\r\n /**\r\n * Select the categories from your data. Used to populate the legend and toolip.\r\n */\r\n categories: KeyOf<T>[]\r\n /**\r\n * Sets the key to map the data to the axis.\r\n */\r\n index: KeyOf<T>\r\n /**\r\n * Change the default colors.\r\n */\r\n colors?: string[]\r\n /**\r\n * Margin of each the container\r\n */\r\n margin?: Spacing\r\n /**\r\n * Change the opacity of the non-selected field\r\n * @default 0.2\r\n */\r\n filterOpacity?: number\r\n /**\r\n * Function to format X label\r\n */\r\n xFormatter?: (tick: number | Date, i: number, ticks: number[] | Date[]) => string\r\n /**\r\n * Function to format Y label\r\n */\r\n yFormatter?: (tick: number | Date, i: number, ticks: number[] | Date[]) => string\r\n /**\r\n * Controls the visibility of the X axis.\r\n * @default true\r\n */\r\n showXAxis?: boolean\r\n /**\r\n * Controls the visibility of the Y axis.\r\n * @default true\r\n */\r\n showYAxis?: boolean\r\n /**\r\n * Controls the visibility of tooltip.\r\n * @default true\r\n */\r\n showTooltip?: boolean\r\n /**\r\n * Controls the visibility of legend.\r\n * @default true\r\n */\r\n showLegend?: boolean\r\n /**\r\n * Controls the visibility of gridline.\r\n * @default true\r\n */\r\n showGridLine?: boolean\r\n}\r\n",
22+
"content": "export { default as AreaChart } from \"./AreaChart.vue\"\r\n\r\nimport type { Spacing } from \"@unovis/ts\"\r\n\r\ntype KeyOf<T extends Record<string, any>> = Extract<keyof T, string>\r\n\r\nexport interface BaseChartProps<T extends Record<string, any>> {\r\n /**\r\n * The source data, in which each entry is a dictionary.\r\n */\r\n data: T[]\r\n /**\r\n * Select the categories from your data. Used to populate the legend and tooltip.\r\n */\r\n categories: KeyOf<T>[]\r\n /**\r\n * Sets the key to map the data to the axis.\r\n */\r\n index: KeyOf<T>\r\n /**\r\n * Change the default colors.\r\n */\r\n colors?: string[]\r\n /**\r\n * Margin of each the container\r\n */\r\n margin?: Spacing\r\n /**\r\n * Change the opacity of the non-selected field\r\n * @default 0.2\r\n */\r\n filterOpacity?: number\r\n /**\r\n * Function to format X label\r\n */\r\n xFormatter?: (tick: number | Date, i: number, ticks: number[] | Date[]) => string\r\n /**\r\n * Function to format Y label\r\n */\r\n yFormatter?: (tick: number | Date, i: number, ticks: number[] | Date[]) => string\r\n /**\r\n * Controls the visibility of the X axis.\r\n * @default true\r\n */\r\n showXAxis?: boolean\r\n /**\r\n * Controls the visibility of the Y axis.\r\n * @default true\r\n */\r\n showYAxis?: boolean\r\n /**\r\n * Controls the visibility of tooltip.\r\n * @default true\r\n */\r\n showTooltip?: boolean\r\n /**\r\n * Controls the visibility of legend.\r\n * @default true\r\n */\r\n showLegend?: boolean\r\n /**\r\n * Controls the visibility of gridline.\r\n * @default true\r\n */\r\n showGridLine?: boolean\r\n}\r\n",
2323
"type": "registry:ui",
2424
"target": ""
2525
}
2626
]
27-
}
27+
}

0 commit comments

Comments
 (0)