Skip to content

[Phase 1] Implement ChartDemo component and demo data #94

@afucher

Description

@afucher

Create the reusable ChartDemo.astro component that renders interactive AstroChart demos in pages, plus a shared demoData.ts module.

Deliverable

A working chart demo component that can be dropped into any Markdown page and renders an interactive SVG chart with optional code snippet display.

Acceptance Criteria

  • src/components/ChartDemo.astro implemented with props:
    • id: string — unique container ID
    • height?: number — default 500
    • mode?: 'radix' | 'transit' | 'animate' — chart type
    • showCode?: boolean — default true, shows code block
  • Component renders a <div id={id}> container
  • Inline <script is:inline> loads /public/astrochart.js and initializes chart
  • For animate mode: renders a button that calls transit.animate() on click
  • Code snippet display: collapsible <details> with syntax-highlighted code (via Shiki or Prism)
  • <noscript> fallback showing placeholder message
  • src/data/demoData.ts created with:
    • defaultRadixData: AstroData — 15 planets + 12 cusps
    • defaultTransitData: AstroData — transit ring planets + cusps
  • Demo component tested in a test page (src/content/docs/test-demo.md)
  • Chart renders visually correctly in dev server (no console errors)
  • Component is documented with JSDoc comment explaining all props

Related Plan Section

docs-plan.md §6 (Visual & Interactive Examples)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions