Google Antigravity Directory

The #1 directory for Google Antigravity prompts, rules, workflows & MCP servers. Optimized for Gemini 3 agentic development.

Resources

PromptsMCP ServersAntigravity RulesGEMINI.md GuideBest Practices

Company

Submit PromptAntigravityAI.directory

Popular Prompts

Next.js 14 App RouterReact TypeScriptTypeScript AdvancedFastAPI GuideDocker Best Practices

Legal

Privacy PolicyTerms of ServiceContact Us
Featured on FazierFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowAI ToolzShinyLaunchMillion Dot HomepageSolver ToolsFeatured on FazierFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowAI ToolzShinyLaunchMillion Dot HomepageSolver Tools

© 2026 Antigravity AI Directory. All rights reserved.

The #1 directory for Google Antigravity IDE

This website is not affiliated with, endorsed by, or associated with Google LLC. "Google" and "Gemini" are trademarks of Google LLC.

Antigravity AI Directory
PromptsMCPBest PracticesUse CasesLearn
Home
Prompts
Charts and Data Visualization Guide

Charts and Data Visualization Guide

Build interactive charts and data visualizations in Google Antigravity using Recharts and D3.js patterns.

chartsrechartsd3visualization
by antigravity-team
⭐0Stars
.antigravity
# Charts and Data Visualization for Google Antigravity

Create interactive, responsive charts and data visualizations using Recharts and D3.js in your Google Antigravity applications.

## Recharts Setup and Basic Charts

```typescript
// components/charts/LineChart.tsx
"use client";

import { LineChart as RechartsLineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from "recharts";

interface DataPoint {
    name: string;
    value: number;
    target?: number;
}

interface LineChartProps {
    data: DataPoint[];
    title?: string;
    color?: string;
    showTarget?: boolean;
}

export function LineChart({ data, title, color = "#8884d8", showTarget = false }: LineChartProps) {
    return (
        <div className="chart-container">
            {title && <h3 className="chart-title">{title}</h3>}
            <ResponsiveContainer width="100%" height={400}>
                <RechartsLineChart data={data} margin={{ top: 20, right: 30, left: 20, bottom: 5 }}>
                    <CartesianGrid strokeDasharray="3 3" stroke="#f0f0f0" />
                    <XAxis dataKey="name" tick={{ fill: "#666" }} axisLine={{ stroke: "#ccc" }} />
                    <YAxis tick={{ fill: "#666" }} axisLine={{ stroke: "#ccc" }} />
                    <Tooltip
                        contentStyle={{ backgroundColor: "#fff", border: "1px solid #ccc", borderRadius: "8px" }}
                        formatter={(value: number) => [`$${value.toLocaleString()}`, "Value"]}
                    />
                    <Legend />
                    <Line type="monotone" dataKey="value" stroke={color} strokeWidth={2} dot={{ fill: color }} activeDot={{ r: 8 }} />
                    {showTarget && <Line type="monotone" dataKey="target" stroke="#ff7300" strokeDasharray="5 5" />}
                </RechartsLineChart>
            </ResponsiveContainer>
        </div>
    );
}
```

## Bar Chart with Gradients

```typescript
// components/charts/BarChart.tsx
"use client";

import { BarChart as RechartsBarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Cell } from "recharts";

interface BarChartProps {
    data: Array<{ name: string; value: number }>;
    colors?: string[];
}

const COLORS = ["#0088FE", "#00C49F", "#FFBB28", "#FF8042", "#8884d8"];

export function BarChart({ data, colors = COLORS }: BarChartProps) {
    return (
        <ResponsiveContainer width="100%" height={400}>
            <RechartsBarChart data={data} margin={{ top: 20, right: 30, left: 20, bottom: 5 }}>
                <defs>
                    {colors.map((color, index) => (
                        <linearGradient key={index} id={`gradient-${index}`} x1="0" y1="0" x2="0" y2="1">
                            <stop offset="0%" stopColor={color} stopOpacity={1} />
                            <stop offset="100%" stopColor={color} stopOpacity={0.6} />
                        </linearGradient>
                    ))}
                </defs>
                <CartesianGrid strokeDasharray="3 3" vertical={false} />
                <XAxis dataKey="name" />
                <YAxis />
                <Tooltip formatter={(value: number) => [value.toLocaleString(), "Value"]} />
                <Bar dataKey="value" radius={[8, 8, 0, 0]}>
                    {data.map((_, index) => (
                        <Cell key={`cell-${index}`} fill={`url(#gradient-${index % colors.length})`} />
                    ))}
                </Bar>
            </RechartsBarChart>
        </ResponsiveContainer>
    );
}
```

## Pie Chart with Animation

```typescript
// components/charts/PieChart.tsx
"use client";

import { useState } from "react";
import { PieChart as RechartsPieChart, Pie, Cell, Sector, ResponsiveContainer, Legend } from "recharts";

const COLORS = ["#0088FE", "#00C49F", "#FFBB28", "#FF8042", "#8884d8"];

const renderActiveShape = (props: any) => {
    const { cx, cy, innerRadius, outerRadius, startAngle, endAngle, fill, payload, percent, value } = props;
    return (
        <g>
            <text x={cx} y={cy} dy={-10} textAnchor="middle" fill="#333" fontSize={16} fontWeight="bold">
                {payload.name}
            </text>
            <text x={cx} y={cy} dy={15} textAnchor="middle" fill="#666" fontSize={14}>
                {`${value.toLocaleString()} (${(percent * 100).toFixed(1)}%)`}
            </text>
            <Sector cx={cx} cy={cy} innerRadius={innerRadius} outerRadius={outerRadius + 10} startAngle={startAngle} endAngle={endAngle} fill={fill} />
            <Sector cx={cx} cy={cy} innerRadius={outerRadius + 12} outerRadius={outerRadius + 16} startAngle={startAngle} endAngle={endAngle} fill={fill} />
        </g>
    );
};

export function PieChart({ data }: { data: Array<{ name: string; value: number }> }) {
    const [activeIndex, setActiveIndex] = useState(0);
    
    return (
        <ResponsiveContainer width="100%" height={400}>
            <RechartsPieChart>
                <Pie
                    activeIndex={activeIndex}
                    activeShape={renderActiveShape}
                    data={data}
                    cx="50%"
                    cy="50%"
                    innerRadius={80}
                    outerRadius={120}
                    dataKey="value"
                    onMouseEnter={(_, index) => setActiveIndex(index)}
                >
                    {data.map((_, index) => (
                        <Cell key={`cell-${index}`} fill={COLORS[index % COLORS.length]} />
                    ))}
                </Pie>
                <Legend />
            </RechartsPieChart>
        </ResponsiveContainer>
    );
}
```

## Dashboard Component

```typescript
// components/charts/Dashboard.tsx
"use client";

import { LineChart } from "./LineChart";
import { BarChart } from "./BarChart";
import { PieChart } from "./PieChart";

interface DashboardProps {
    revenue: Array<{ name: string; value: number; target: number }>;
    categories: Array<{ name: string; value: number }>;
    distribution: Array<{ name: string; value: number }>;
}

export function Dashboard({ revenue, categories, distribution }: DashboardProps) {
    return (
        <div className="dashboard-grid">
            <div className="chart-card">
                <LineChart data={revenue} title="Monthly Revenue" showTarget />
            </div>
            <div className="chart-card">
                <BarChart data={categories} />
            </div>
            <div className="chart-card">
                <PieChart data={distribution} />
            </div>
        </div>
    );
}
```

## Server-Side Data Fetching

```typescript
// app/dashboard/page.tsx
import { createClient } from "@/lib/supabase/server";
import { Dashboard } from "@/components/charts/Dashboard";

export default async function DashboardPage() {
    const supabase = createClient();
    const { data: metrics } = await supabase.from("metrics").select("*").order("date", { ascending: true });
    
    const revenue = metrics?.map((m) => ({ name: m.month, value: m.revenue, target: m.target })) || [];
    const categories = metrics?.reduce((acc, m) => { /* aggregate */ return acc; }, []) || [];
    
    return <Dashboard revenue={revenue} categories={categories} distribution={[]} />;
}
```

## Best Practices

1. **Responsive Design**: Always use ResponsiveContainer for charts that adapt to screen size
2. **Accessibility**: Add ARIA labels and keyboard navigation for interactive charts
3. **Performance**: Limit data points and use virtualization for large datasets
4. **Theming**: Support dark mode with conditional chart colors
5. **Loading States**: Show skeleton loaders while chart data is being fetched

When to Use This Prompt

This charts prompt is ideal for developers working on:

  • charts applications requiring modern best practices and optimal performance
  • Projects that need production-ready charts code with proper error handling
  • Teams looking to standardize their charts development workflow
  • Developers wanting to learn industry-standard charts patterns and techniques

By using this prompt, you can save hours of manual coding and ensure best practices are followed from the start. It's particularly valuable for teams looking to maintain consistency across their charts implementations.

How to Use

  1. Copy the prompt - Click the copy button above to copy the entire prompt to your clipboard
  2. Paste into your AI assistant - Use with Claude, ChatGPT, Cursor, or any AI coding tool
  3. Customize as needed - Adjust the prompt based on your specific requirements
  4. Review the output - Always review generated code for security and correctness
💡 Pro Tip: For best results, provide context about your project structure and any specific constraints or preferences you have.

Best Practices

  • ✓ Always review generated code for security vulnerabilities before deploying
  • ✓ Test the charts code in a development environment first
  • ✓ Customize the prompt output to match your project's coding standards
  • ✓ Keep your AI assistant's context window in mind for complex requirements
  • ✓ Version control your prompts alongside your code for reproducibility

Frequently Asked Questions

Can I use this charts prompt commercially?

Yes! All prompts on Antigravity AI Directory are free to use for both personal and commercial projects. No attribution required, though it's always appreciated.

Which AI assistants work best with this prompt?

This prompt works excellently with Claude, ChatGPT, Cursor, GitHub Copilot, and other modern AI coding assistants. For best results, use models with large context windows.

How do I customize this prompt for my specific needs?

You can modify the prompt by adding specific requirements, constraints, or preferences. For charts projects, consider mentioning your framework version, coding style, and any specific libraries you're using.

Related Prompts

💬 Comments

Loading comments...