Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lite component for GPTVis #12

Merged
merged 2 commits into from
Nov 19, 2024
Merged

feat: lite component for GPTVis #12

merged 2 commits into from
Nov 19, 2024

Conversation

lvisei
Copy link
Member

@lvisei lvisei commented Nov 19, 2024

import { GPTVisLite, withChartCode, ChartType, Pie } from '@antv/gpt-vis';

const markdownContent = `
\`\`\`my-ui
my data
\`\`\`

\`\`\`vis-chart
{
  "type": "pie",
  "data": [
    { "category": "category 1", "value": 27 },
    { "category": "category 2", "value": 25 },
    { "category": "category 3", "value": 18 },
    { "category": "other", "value": 5 }
  ]
}
\`\`\`
`;

const customRenderers = { 'my-ui': ({ children }) => <div>{children}</div> };
const components = {
  code: withChartCode({
    languageRenderers: customRenderers, // register custom block renderer
    components: { [ChartType.Pie]: Pie }, // register a pie chart
  }),
};

export default () => {
  return <GPTVisLite components={components}>{markdownContent}</GPTVisLite>;
};

Copy link

changeset-bot bot commented Nov 19, 2024

🦋 Changeset detected

Latest commit: 61303fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@antv/gpt-vis Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

😭 Deploy PR Preview 61303fb failed. Build logs

🤖 By surge-preview

Copy link
Contributor

⚡️ Deploying PR Preview 61303fb to surge.sh ... Build logs

🤖 By surge-preview

@lvisei lvisei changed the title feat: lite render GPTVis feat: lite component for GPTVis Nov 19, 2024
@lvisei lvisei merged commit 6fbc29d into main Nov 19, 2024
8 checks passed
@lvisei lvisei deleted the feat/lite branch November 19, 2024 09:05
@github-actions github-actions bot mentioned this pull request Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants