feat: Vega and Vega Lite components API and docs improvements
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
// Wrapper for the Vega component
|
// Wrapper for the Vega component
|
||||||
import { Vega as VegaOg } from "react-vega";
|
import { Vega as VegaOg } from "react-vega";
|
||||||
|
import { VegaProps } from "react-vega/lib/Vega";
|
||||||
|
|
||||||
export function Vega(props) {
|
export function Vega(props: VegaProps) {
|
||||||
return <VegaOg {...props} />;
|
return <VegaOg {...props} />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
// Wrapper for the Vega Lite component
|
// Wrapper for the Vega Lite component
|
||||||
import { VegaLite as VegaLiteOg } from "react-vega";
|
import { VegaLite as VegaLiteOg } from 'react-vega';
|
||||||
import applyFullWidthDirective from "../lib/applyFullWidthDirective";
|
import { VegaLiteProps } from 'react-vega/lib/VegaLite';
|
||||||
|
import applyFullWidthDirective from '../lib/applyFullWidthDirective';
|
||||||
|
|
||||||
export function VegaLite(props) {
|
export function VegaLite(props: VegaLiteProps) {
|
||||||
const Component = applyFullWidthDirective({ Component: VegaLiteOg });
|
const Component = applyFullWidthDirective({ Component: VegaLiteOg });
|
||||||
|
|
||||||
return <Component {...props} />;
|
return <Component {...props} />;
|
||||||
|
|||||||
@@ -7,6 +7,16 @@ const meta: Meta = {
|
|||||||
title: 'Components/Charts/Vega',
|
title: 'Components/Charts/Vega',
|
||||||
component: Vega,
|
component: Vega,
|
||||||
tags: ['autodocs'],
|
tags: ['autodocs'],
|
||||||
|
argTypes: {
|
||||||
|
data: {
|
||||||
|
description:
|
||||||
|
"Vega's `data` prop. You can find references on how to use this prop at https://vega.github.io/vega/docs/data/",
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
description:
|
||||||
|
"Vega's `spec` prop. You can find references on how to use this prop at https://vega.github.io/vega/docs/specification/",
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default meta;
|
export default meta;
|
||||||
@@ -15,7 +25,7 @@ type Story = StoryObj<any>;
|
|||||||
|
|
||||||
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
||||||
export const Primary: Story = {
|
export const Primary: Story = {
|
||||||
name: 'Chart built with Vega',
|
name: 'Bar chart',
|
||||||
args: {
|
args: {
|
||||||
data: {
|
data: {
|
||||||
table: [
|
table: [
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ type Story = StoryObj<any>;
|
|||||||
|
|
||||||
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
||||||
export const Primary: Story = {
|
export const Primary: Story = {
|
||||||
name: 'Chart built with Vega Lite',
|
name: 'Bar chart',
|
||||||
args: {
|
args: {
|
||||||
data: {
|
data: {
|
||||||
table: [
|
table: [
|
||||||
|
|||||||
Reference in New Issue
Block a user