
Chartjs Generator
- 78 installs
- 2 repo stars
- Updated August 1, 2026
- vishalsachdev/claude-skills
Helps with ai & agent building tasks.
About
chartjs-generator is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- chartjs-generator
- AI & Agent Building
- AI-coding skill
Chartjs Generator by the numbers
- 78 all-time installs (skills.sh)
- +4 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #5,265 of 16,556 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/vishalsachdev/claude-skills --skill chartjs-generatorAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 78 |
|---|---|
| repo stars | ★ 2 |
| Last updated | August 1, 2026 |
| Repository | vishalsachdev/claude-skills ↗ |
What it does
Helps with ai & agent building tasks.
Files
Chart.js Generator
Overview
This skill generates professional, interactive charts using Chart.js, supporting all major chart types. Chart.js is a powerful, flexible JavaScript library for creating responsive data visualizations. The skill creates a complete MicroSim package suitable for embedding in educational content or documentation sites built with MkDocs. The default placement in a intelligent book uses an iframe with minimal padding and margins. Do not add any analysis or supporting documentation above or below the chart region.
Supported Chart Types
Chart.js supports the following chart types:
1. Line - Time series, trends, continuous data 2. Bar - Comparisons, categorical data, horizontal or vertical 3. Pie - Proportions, percentages, part-to-whole relationships 4. Doughnut - Similar to pie with central space for labels 5. Radar - Multi-dimensional data, spider/web charts 6. Polar Area - Similar to pie but with varying radius 7. Bubble - Three-dimensional data (x, y, size) 8. Scatter - Correlations, distributions, relationships
When to Use This Skill
Use this skill when users request:
- Data visualizations: Any chart or graph for presenting data
- Comparisons: Bar charts, grouped bars, stacked bars
- Trends: Line charts, area charts, multi-line charts
- Proportions: Pie charts, doughnut charts
- Distributions: Scatter plots, bubble charts
- Multi-dimensional data: Radar charts, bubble charts
- Interactive charts: Hover tooltips, clickable elements, animations
Common trigger phrases:
- "Create a [chart type] showing..."
- "Visualize [data] as a [chart type]..."
- "Build an interactive chart for..."
- "Generate a graph showing..."
Workflow
Step 1: Determine Chart Type
If the user doesn't specify a chart type, ask them to select from the supported types:
Use the AskUserQuestion tool with these options:
1. Line Chart - Best for trends over time, continuous data 2. Bar Chart - Best for comparing categories, discrete data 3. Pie/Doughnut Chart - Best for showing proportions and percentages 4. Bubble/Scatter Chart - Best for multi-dimensional or correlation data 5. Radar Chart - Best for comparing multiple variables across categories 6. Polar Area Chart - Best for showing proportions with emphasis on differences
Step 2: Gather Data and Requirements
Before generating the chart, gather information about:
1. Data structure: What data needs to be visualized?
- Data points/values
- Labels/categories
- Multiple datasets (if applicable)
- Time periods or categories
- Units of measurement
2. Chart configuration:
- Chart title
- Axis labels (for bar, line, scatter, bubble charts)
- Legend requirements
- Color scheme preferences
- Special features (stacked, grouped, filled areas, etc.)
3. Context: What is the purpose of the visualization?
- Educational content
- Data analysis
- Report or presentation
- Dashboard component
4. Integration: Where will the chart be used?
- Standalone page
- Embedded in documentation
- MkDocs site integration
Step 3: Create Directory Structure
Create a new directory for the MicroSim following this pattern:
docs/sims/<chart-name>/
├── main.html # Main visualization file
├── style.css # Styling
└── index.md # Documentation (if part of MkDocs)Naming convention: Use kebab-case (lowercase with hyphens) for directory names that are descriptive and URL-friendly (e.g., sales-trend-chart, market-share-pie, student-performance-radar).
Step 4: Create main.html with Chart.js
Generate the main HTML file with the following structure:
1. HTML boilerplate with proper meta tags 2. Chart.js CDN import: https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js 3. Canvas element for the chart 4. Optional analysis/legend section do not any analysis or documentation unless requested 5. JavaScript implementation:
- Data array/object
- Color scheme configuration
- Chart.js configuration for the selected chart type
- Custom plugins (if needed)
- Interactive features (tooltips, legends, animations)
- Tooltips should always be used
Key Chart.js configuration by type:
Line Chart
{
type: 'line',
data: {
labels: ['Jan', 'Feb', 'Mar', ...],
datasets: [{
label: 'Dataset 1',
data: [12, 19, 3, 5, 2, 3],
borderColor: 'rgb(75, 192, 192)',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
tension: 0.1 // Curve smoothness
}]
},
options: {
responsive: true,
scales: {
y: { beginAtZero: true }
}
}
}Bar Chart
{
type: 'bar',
data: {
labels: ['Category A', 'Category B', ...],
datasets: [{
label: 'Dataset 1',
data: [65, 59, 80, 81, 56, 55],
backgroundColor: 'rgba(54, 162, 235, 0.8)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1
}]
},
options: {
responsive: true,
scales: {
y: { beginAtZero: true }
}
}
}Pie/Doughnut Chart
{
type: 'pie', // or 'doughnut'
data: {
labels: ['Red', 'Blue', 'Yellow', ...],
datasets: [{
data: [300, 50, 100],
backgroundColor: [
'rgba(255, 99, 132, 0.8)',
'rgba(54, 162, 235, 0.8)',
'rgba(255, 206, 86, 0.8)'
]
}]
},
options: {
responsive: true,
plugins: {
legend: { position: 'top' }
}
}
}Radar Chart
{
type: 'radar',
data: {
labels: ['Strength', 'Speed', 'Intelligence', ...],
datasets: [{
label: 'Player 1',
data: [65, 59, 90, 81, 56],
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgb(255, 99, 132)',
pointBackgroundColor: 'rgb(255, 99, 132)'
}]
},
options: {
responsive: true,
scales: {
r: {
beginAtZero: true,
max: 100
}
}
}
}Bubble Chart
{
type: 'bubble',
data: {
datasets: [{
label: 'Dataset 1',
data: [
{ x: 20, y: 30, r: 15 }, // r = bubble radius
{ x: 40, y: 10, r: 10 }
],
backgroundColor: 'rgba(255, 99, 132, 0.8)'
}]
},
options: {
responsive: true,
scales: {
x: { min: 0, max: 100 },
y: { min: 0, max: 100 }
}
}
}Scatter Chart
{
type: 'scatter',
data: {
datasets: [{
label: 'Dataset 1',
data: [
{ x: -10, y: 0 },
{ x: 0, y: 10 },
{ x: 10, y: 5 }
],
backgroundColor: 'rgba(255, 99, 132, 0.8)'
}]
},
options: {
responsive: true,
scales: {
x: { type: 'linear', position: 'bottom' }
}
}
}Important considerations:
- Responsive design: Set
responsive: trueand appropriate aspect ratio - Color accessibility: Use distinguishable colors with good contrast
- Tooltips: Customize tooltips to show relevant information
- Legends: Position legends appropriately (
top,bottom,left,right) - Animations: Enable/disable based on use case
- Data labels: Use Chart.js plugins for data labels if needed
Step 5: Create style.css
Generate CSS with professional styling:
1. Reset and base styles: Clean defaults for cross-browser consistency 2. Chart container: Appropriate sizing, padding, box-shadow 3. Legend/analysis container: Styling for supplementary information 4. Interactive elements: Hover effects, transitions 5. Responsive design: Media queries for mobile/tablet 6. Print styles: Do not add additional CSS for printing
Key design principles:
- Use clean, modern aesthetics
- Assume placement of the chart in a book with narrow margins using a iframe
- Provide clear visual hierarchy
- Add subtle shadows and borders
- Include smooth transitions
- Ensure accessibility with sufficient contrast
- Make text readable at all sizes
Step 6: Create index.md Documentation
If the chart is part of a MkDocs site, create comprehensive documentation:
1. YML Metadata: Add title, and description 1. Title and overview: Brief description of the visualization 2. Embedded iframe: Display the chart inline 3. Link to fullscreen: Markdown link to main.html with button "View MicroSim Fullscreen" 4. Interpretation guide: Explain how to read the chart 5. Features section: List interactive elements 6. Customization guide: Detailed instructions for modifying:
- Data structure
- Colors and styling
- Chart options
- Responsive behavior
- Animations
7. Technical details: Dependencies, browser compatibility, file structure 8. Use cases: Other applications for this chart type 9. References: Links to Chart.js docs and related resources
Documentation structure template:
---
title: [Chart Title]
description: [brief description of chart]
---
# [Chart Title]
[Brief description]
## Interactive Chart
<iframe src="main.html" width="100%" height="500" scrolling="no"></iframe>
[View Fullscreen](main.html){ .md-button .md-button--primary }
## Overview
[Detailed explanation of what the chart shows]
## Features
### Interactive Elements
- Hover tooltips showing detailed data
- Clickable legend items to show/hide datasets
- Smooth animations on load and update
### Visual Design
- Color-coded categories
- Clear axis labels and grid lines
- Responsive layout
## Customization Guide
### Changing the Data
To modify the chart data, edit the `data` object in `main.html`:
const data = { labels: ['Your', 'Labels', 'Here'], datasets: [{ label: 'Your Dataset', data: [10, 20, 30, 40] }] };
### Adjusting Colors
Customize the color scheme by modifying the `backgroundColor` and `borderColor` properties:
backgroundColor: [ 'rgba(255, 99, 132, 0.8)', 'rgba(54, 162, 235, 0.8)', // Add more colors... ]
### Chart Options
Modify chart behavior in the `options` object:
options: { responsive: true, maintainAspectRatio: true, aspectRatio: 2, // Width:height ratio plugins: { title: { display: true, text: 'Your Title' }, legend: { position: 'top' } } }
## Technical Details
- **Library**: Chart.js 4.4.0
- **Browser Compatibility**: All modern browsers (Chrome, Firefox, Safari, Edge)
- **Dependencies**: Chart.js (loaded from CDN)
- **Responsive**: Yes, adapts to container width
## Use Cases
This chart type is useful for:
- [List relevant use cases]
## References
### Step 7: Integrate into Navigation (MkDocs)
Always add the chart to the navigation in `mkdocs.yml`:
- MicroSims:
- Introduction: sims/index.md
- [Chart Name]: sims/[chart-name]/index.md
- [Other sims...]: ...
Place the entry in a alphabetical order.
### Step 8: Test and Validate
Before considering the chart complete:
1. **Visual testing**:
- Open `main.html` in a browser directly
- Test with `mkdocs serve` if applicable
- Check all breakpoints (desktop, tablet, mobile)
- Verify data displays correctly
- Confirm labels and legends are readable
2. **Interactive testing**:
- Hover over chart elements to verify tooltips
- Click legend items to show/hide datasets
- Test animations (reload page)
- Test on different browsers
3. **Documentation review**:
- Verify all code examples are accurate
- Test customization instructions
- Check all internal and external links
4. **Data validation**:
- Confirm all data points are plotted correctly
- Verify calculations if applicable
- Check that chart accurately represents the data
## Best Practices
### Data Preparation
1. **Consistent formatting**: Use consistent data types and formats
2. **Meaningful labels**: Use clear, descriptive labels
3. **Appropriate scale**: Choose scales that show data effectively
4. **Complete data**: Ensure all required fields are present
### Visual Design
1. **Color coding**: Use intuitive, accessible color schemes
2. **Contrast**: Ensure sufficient contrast for readability
3. **Labels**: Make all text readable at different sizes
4. **Spacing**: Prevent overlap with appropriate padding
5. **Consistency**: Use consistent styling across charts
### Documentation
1. **Code examples**: Provide exact, testable code snippets
2. **Before/after**: Show the effect of customizations
3. **Parameter ranges**: Suggest appropriate value ranges
4. **Common issues**: Address typical problems and solutions
### MkDocs Integration
1. **Iframe sizing**: Use appropriate height for chart type (typically 500-900px)
2. **Path references**: Use relative paths (`../sims/...`)
3. **Navigation placement**: Group with related MicroSims
4. **Responsive embedding**: Ensure iframe is responsive
## Chart Type Selection Guide
Help users choose the right chart type:
| Chart Type | Best For | Not Suitable For |
|------------|----------|------------------|
| **Line** | Trends over time, continuous data | Categorical comparisons |
| **Bar** | Comparing categories, discrete data | Trends, continuous data |
| **Pie/Doughnut** | Part-to-whole, proportions (≤6 slices) | Precise comparisons, many categories |
| **Radar** | Comparing multiple variables, profiles | Single variable, continuous data |
| **Polar Area** | Proportions with emphasis on differences | Precise comparisons |
| **Bubble** | Three dimensions (x, y, size) | Simple 1D or 2D data |
| **Scatter** | Correlations, distributions | Categorical data |
## Common Variations
### Stacked Bar Chartoptions: { scales: { x: { stacked: true }, y: { stacked: true } } }
### Horizontal Bar Chart{ type: 'bar', options: { indexAxis: 'y' // Makes bars horizontal } }
### Multi-Line Chart
Add multiple datasets to a line chart:data: { datasets: [ { label: 'Series 1', data: [...], borderColor: 'red' }, { label: 'Series 2', data: [...], borderColor: 'blue' } ] }
### Filled Area Chart{ type: 'line', data: { datasets: [{ fill: true, // Fill area under line backgroundColor: 'rgba(75, 192, 192, 0.2)' }] } }
## Troubleshooting
### Chart Not Displaying
**Solution**: Check that Chart.js CDN is loading correctly and canvas element has an ID.
### Data Not Updating
**Solution**: Ensure `chart.update()` is called after modifying data:chart.data.datasets[0].data = newData; chart.update();
### Labels Overlapping
**Solution**: Rotate labels or reduce font size:scales: { x: { ticks: { maxRotation: 45, minRotation: 45 } } }
### Colors Not Showing
**Solution**: Verify color format (rgba, rgb, hex) and ensure arrays match data length.
### Responsive Issues
**Solution**: Set container dimensions and use `maintainAspectRatio`:options: { responsive: true, maintainAspectRatio: true, aspectRatio: 2 }
## Advanced Features
### Data Labels Plugin
To show values on chart elements, use the Chart.js Data Labels plugin:<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2"></script>
### Animations
Customize animation timing and easing:options: { animation: { duration: 2000, easing: 'easeInOutQuart' } }
### Custom Tooltips
Create fully custom tooltip content:plugins: { tooltip: { callbacks: { label: function(context) { return 'Custom: ' + context.parsed.y; } } } }
### Click Events
Handle click events on chart elements:options: { onClick: (event, elements) => { if (elements.length > 0) { const dataIndex = elements[0].index; console.log('Clicked:', chart.data.labels[dataIndex]); } } }
## References
This skill uses the following assets and references:
### Assets
- **Chart.js CDN**: `https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js`
- **Optional Data Labels Plugin**: `https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2`
- No local assets required (Chart.js loaded from CDN)
### References
- [Chart.js Documentation](https://www.chartjs.org/docs/latest/)
- [Chart.js Samples](https://www.chartjs.org/docs/latest/samples/)
- [Chart.js GitHub](https://github.com/chartjs/Chart.js)
- [Chart Types Guide](https://www.chartjs.org/docs/latest/charts/)
### Example Implementations
See example charts in `/docs/sims/` directory for reference implementations of different chart types.
Chart.js Generator Assets
This directory contains template files for creating various types of Chart.js visualizations. Each template is ready to use and includes TODO markers for easy customization.
Available Templates
Chart Type Templates
1. template-line.html - Line chart for trends and time series data 2. template-bar.html - Bar chart for categorical comparisons 3. template-pie.html - Pie chart for proportions and percentages 4. template-doughnut.html - Doughnut chart (pie with center hole) 5. template-radar.html - Radar/spider chart for multi-dimensional data 6. template-polar.html - Polar area chart for proportional data with emphasis 7. template-bubble.html - Bubble chart for three-dimensional data 8. template-scatter.html - Scatter plot for correlations and distributions
Supporting Templates
- template-style.css - Professional CSS styling for all chart types
- template-index.md - MkDocs documentation template
Template Features
All HTML templates include:
- Complete HTML5 boilerplate with proper meta tags
- Chart.js 4.4.0 CDN import
- Canvas element for chart rendering
- Sample data with clear structure
- Comprehensive Chart.js configuration
- TODO markers for easy customization
- Commented code explaining key sections
- Responsive design settings
- Professional styling
Quick Start Guide
1. Choose Your Chart Type
Select the template that best fits your data:
| Template | Best For | Not Suitable For |
|---|---|---|
| Line | Trends over time, continuous data | Categorical comparisons |
| Bar | Comparing categories, discrete data | Trends, continuous data |
| Pie/Doughnut | Part-to-whole (≤6 categories) | Precise comparisons, many categories |
| Radar | Multi-variable comparisons | Single variable data |
| Polar | Proportions with emphasis | Precise comparisons |
| Bubble | Three dimensions (x, y, size) | Simple 1D or 2D data |
| Scatter | Correlations, distributions | Categorical data |
2. Create Chart Directory
mkdir -p docs/sims/my-chart-name
cd docs/sims/my-chart-name3. Copy Templates
# Copy the chart template
cp /path/to/skills/chartjs-generator/assets/template-[type].html main.html
# Copy the style template
cp /path/to/skills/chartjs-generator/assets/template-style.css style.css
# Copy the documentation template (optional)
cp /path/to/skills/chartjs-generator/assets/template-index.md index.md4. Customize Your Chart
Edit main.html and replace the TODO sections:
1. Chart title - Update the page title and chart title 2. Data - Replace sample data with your actual data 3. Colors - Customize the color scheme 4. Labels - Update axis labels and legend text 5. Options - Adjust chart-specific options
5. Test Your Chart
Open main.html in a web browser to view your chart. If using MkDocs:
mkdocs serveThen navigate to your chart page.
Customization Examples
Line Chart - Time Series Data
const data = {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
datasets: [{
label: 'Sales ($1000s)',
data: [12, 19, 3, 5, 2, 3],
borderColor: 'rgb(75, 192, 192)',
tension: 0.1
}]
};Bar Chart - Category Comparison
const data = {
labels: ['Product A', 'Product B', 'Product C', 'Product D'],
datasets: [{
label: 'Units Sold',
data: [65, 59, 80, 81],
backgroundColor: 'rgba(54, 162, 235, 0.8)'
}]
};Pie/Doughnut - Proportions
const data = {
labels: ['Chrome', 'Firefox', 'Safari', 'Edge', 'Other'],
datasets: [{
data: [65, 15, 10, 7, 3],
backgroundColor: [
'rgba(255, 99, 132, 0.8)',
'rgba(54, 162, 235, 0.8)',
'rgba(255, 206, 86, 0.8)',
'rgba(75, 192, 192, 0.8)',
'rgba(201, 203, 207, 0.8)'
]
}]
};Radar - Multi-Dimensional Comparison
const data = {
labels: ['Speed', 'Strength', 'Intelligence', 'Agility', 'Stamina'],
datasets: [{
label: 'Character A',
data: [80, 70, 60, 85, 75],
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgb(255, 99, 132)'
}]
};Bubble - Three Dimensions
const data = {
datasets: [{
label: 'Projects',
data: [
{ x: 20, y: 30, r: 15 }, // x = effort, y = impact, r = cost
{ x: 40, y: 10, r: 10 }
],
backgroundColor: 'rgba(255, 99, 132, 0.8)'
}]
};Color Schemes
Professional Color Palette
// Primary colors with transparency
const colors = {
red: 'rgba(255, 99, 132, 0.8)',
blue: 'rgba(54, 162, 235, 0.8)',
yellow: 'rgba(255, 206, 86, 0.8)',
green: 'rgba(75, 192, 192, 0.8)',
purple: 'rgba(153, 102, 255, 0.8)',
orange: 'rgba(255, 159, 64, 0.8)',
gray: 'rgba(201, 203, 207, 0.8)'
};
// Solid border colors
const borderColors = {
red: 'rgb(255, 99, 132)',
blue: 'rgb(54, 162, 235)',
yellow: 'rgb(255, 206, 86)',
green: 'rgb(75, 192, 192)',
purple: 'rgb(153, 102, 255)',
orange: 'rgb(255, 159, 64)',
gray: 'rgb(201, 203, 207)'
};Accessibility-Friendly Colors
Use color combinations with sufficient contrast:
const accessibleColors = [
'rgba(0, 114, 178, 0.8)', // Blue
'rgba(230, 159, 0, 0.8)', // Orange
'rgba(0, 158, 115, 0.8)', // Green
'rgba(204, 121, 167, 0.8)', // Pink
'rgba(86, 180, 233, 0.8)' // Sky blue
];Common Customizations
Change Chart Aspect Ratio
options: {
aspectRatio: 2 // Width:height (2 = twice as wide as tall)
}Disable Animations
options: {
animation: false
}Custom Tooltips
options: {
plugins: {
tooltip: {
callbacks: {
label: function(context) {
return 'Value: ' + context.parsed.y + ' units';
}
}
}
}
}Stacked Bar/Line Charts
options: {
scales: {
x: { stacked: true },
y: { stacked: true }
}
}Horizontal Bar Chart
{
type: 'bar',
options: {
indexAxis: 'y' // Makes bars horizontal
}
}Troubleshooting
Chart Not Displaying
- Verify Chart.js CDN is loading (check browser console)
- Ensure canvas element has correct ID
- Check for JavaScript errors in console
Data Not Showing Correctly
- Verify data array structure matches chart type
- Check that labels array length matches data array length
- Ensure numeric values are not strings
Labels Overlapping
scales: {
x: {
ticks: {
maxRotation: 45,
minRotation: 45
}
}
}Colors Not Appearing
- Ensure color arrays match data length
- Use proper rgba() or rgb() format
- Check alpha channel value (0.0-1.0)
Advanced Features
Data Labels Plugin
Add value labels directly on chart elements:
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2"></script>options: {
plugins: {
datalabels: {
color: '#fff',
font: { weight: 'bold' }
}
}
}Click Events
Handle clicks on chart elements:
options: {
onClick: (event, elements) => {
if (elements.length > 0) {
const index = elements[0].index;
console.log('Clicked:', chart.data.labels[index]);
}
}
}Custom Plugins
Add background colors, watermarks, or other custom features:
plugins: [{
afterDraw: function(chart) {
const ctx = chart.ctx;
// Custom drawing code here
}
}]Best Practices
Data Preparation
1. Validate data - Ensure all values are numeric and complete 2. Normalize scales - Use consistent ranges for comparability 3. Meaningful labels - Use clear, descriptive labels 4. Limit categories - Keep pie charts to ≤6 slices for readability
Visual Design
1. Color accessibility - Use high-contrast, colorblind-friendly colors 2. Consistent styling - Match colors to your brand or theme 3. Clear labels - Ensure all text is readable at different sizes 4. Appropriate chart type - Choose the right visualization for your data
Performance
1. Limit data points - For line/scatter charts, avoid thousands of points 2. Disable animations - For large datasets or print views 3. Use decimation - Sample large datasets appropriately
Documentation
1. Explain the data - Describe what the chart shows 2. Provide context - Explain why the visualization matters 3. Include customization guide - Help others modify the chart 4. Link to references - Cite Chart.js documentation
File Organization
When creating charts for MkDocs sites:
docs/sims/
├── chart-name-1/
│ ├── main.html
│ ├── style.css
│ └── index.md
├── chart-name-2/
│ ├── main.html
│ ├── style.css
│ └── index.md
└── index.md # Overview of all chartsReferences
- Chart.js Official Documentation
- Chart.js Samples
- Chart.js GitHub Repository
- Chart.js Community Plugins
- Color Contrast Checker
Support
For issues or questions:
1. Check the Chart.js documentation 2. Search Chart.js GitHub issues 3. Review the SKILL.md file for workflow guidance 4. Examine example implementations in /docs/sims/
---
Part of the chartjs-generator skill for creating interactive Chart.js visualizations
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bar Chart - Chart.js</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
</head>
<body>
<div class="chart-container">
<canvas id="myChart"></canvas>
</div>
<script>
// TODO: Replace with actual data
const data = {
labels: ['Category A', 'Category B', 'Category C', 'Category D', 'Category E', 'Category F'],
datasets: [{
label: 'Dataset 1',
data: [65, 59, 80, 81, 56, 55],
backgroundColor: 'rgba(54, 162, 235, 0.8)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1
}]
};
// TODO: Customize chart options
const config = {
type: 'bar',
data: data,
options: {
responsive: true,
maintainAspectRatio: true,
aspectRatio: 2,
plugins: {
title: {
display: true,
text: 'Bar Chart Title', // TODO: Customize title
font: {
size: 18,
weight: 'bold'
},
padding: 20
},
legend: {
display: true,
position: 'top',
labels: {
font: {
size: 12
},
usePointStyle: true
}
},
tooltip: {
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
label += context.parsed.y.toFixed(2);
return label;
}
}
}
},
scales: {
x: {
title: {
display: true,
text: 'Categories', // TODO: Customize label
font: {
size: 14,
weight: 'bold'
}
},
grid: {
display: false
}
},
y: {
title: {
display: true,
text: 'Values', // TODO: Customize label
font: {
size: 14,
weight: 'bold'
}
},
beginAtZero: true,
grid: {
color: 'rgba(200, 200, 200, 0.2)'
}
}
}
}
};
// Create chart
const ctx = document.getElementById('myChart').getContext('2d');
const chart = new Chart(ctx, config);
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>[Chart Title] - Priority Matrix</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
</head>
<body>
<div class="chart-container">
<canvas id="priorityMatrix"></canvas>
</div>
<div class="legend-container">
<h3>Quadrant Analysis</h3>
<div class="quadrant">
<div class="quadrant-label high-impact-low-effort">High Impact, Low Effort (Priority 1)</div>
<ul id="q1-items"></ul>
</div>
<div class="quadrant">
<div class="quadrant-label high-impact-high-effort">High Impact, High Effort (Priority 2)</div>
<ul id="q2-items"></ul>
</div>
<div class="quadrant">
<div class="quadrant-label low-impact-low-effort">Low Impact, Low Effort (Priority 3)</div>
<ul id="q3-items"></ul>
</div>
<div class="quadrant">
<div class="quadrant-label low-impact-high-effort">Low Impact, High Effort (Priority 4)</div>
<ul id="q4-items"></ul>
</div>
</div>
<script>
// TODO: Replace with actual data
const data = [
{ type: 'item-1', count: 10, xValue: 6.7, yValue: 1, status: 'Category A' },
{ type: 'item-2', count: 5, xValue: 3.3, yValue: 0, status: 'Category B' },
// Add more items...
];
// TODO: Customize colors for your categories
const colors = {
'Category A': 'rgba(220, 53, 69, 0.8)',
'Category B': 'rgba(40, 167, 69, 0.8)'
};
const borderColors = {
'Category A': 'rgb(220, 53, 69)',
'Category B': 'rgb(40, 167, 69)'
};
// Calculate bubble sizes
const minCount = Math.min(...data.map(d => d.count));
const maxCount = Math.max(...data.map(d => d.count));
function getBubbleSize(count) {
const minSize = 8;
const maxSize = 30;
return minSize + ((count - minCount) / (maxCount - minCount)) * (maxSize - minSize);
}
// Prepare scatter plot data
const scatterData = data.map(item => ({
x: item.xValue,
y: item.yValue,
r: getBubbleSize(item.count),
label: item.type,
count: item.count,
status: item.status
}));
// Group by status/category
const uniqueStatuses = [...new Set(data.map(d => d.status))];
const datasets = uniqueStatuses.map(status => ({
label: status,
data: scatterData.filter(d => d.status === status),
backgroundColor: colors[status],
borderColor: borderColors[status],
borderWidth: 2
}));
// Create chart
const ctx = document.getElementById('priorityMatrix').getContext('2d');
const chart = new Chart(ctx, {
type: 'bubble',
data: {
datasets: datasets
},
options: {
responsive: true,
maintainAspectRatio: true,
aspectRatio: 1.5,
plugins: {
title: {
display: true,
text: '[Chart Title]', // TODO: Customize title
font: {
size: 18,
weight: 'bold'
},
padding: 20
},
legend: {
display: true,
position: 'top',
labels: {
font: {
size: 12
},
usePointStyle: true
}
},
tooltip: {
callbacks: {
label: function(context) {
const item = context.raw;
return [
`Type: ${item.label}`,
`Count: ${item.count}`,
`Y-Value: ${item.y}`,
`X-Value: ${item.x}`,
`Status: ${item.status}`
];
}
}
}
},
scales: {
x: {
title: {
display: true,
text: 'X-Axis Label →', // TODO: Customize label
font: {
size: 14,
weight: 'bold'
}
},
min: 0,
max: 10,
ticks: {
stepSize: 1
},
grid: {
color: 'rgba(200, 200, 200, 0.2)'
}
},
y: {
title: {
display: true,
text: 'Y-Axis Label →', // TODO: Customize label
font: {
size: 14,
weight: 'bold'
}
},
min: 0,
max: 10,
ticks: {
stepSize: 1
},
grid: {
color: 'rgba(200, 200, 200, 0.2)'
}
}
}
},
plugins: [{
afterDraw: function(chart) {
const ctx = chart.ctx;
const chartArea = chart.chartArea;
const xMid = (chartArea.left + chartArea.right) / 2;
const yMid = (chartArea.top + chartArea.bottom) / 2;
// Draw quadrant backgrounds
ctx.save();
ctx.globalAlpha = 0.05;
// TODO: Customize quadrant colors
ctx.fillStyle = 'green'; // High Y, Low X
ctx.fillRect(chartArea.left, chartArea.top, xMid - chartArea.left, yMid - chartArea.top);
ctx.fillStyle = 'yellow'; // High Y, High X
ctx.fillRect(xMid, chartArea.top, chartArea.right - xMid, yMid - chartArea.top);
ctx.fillStyle = 'lightblue'; // Low Y, Low X
ctx.fillRect(chartArea.left, yMid, xMid - chartArea.left, chartArea.bottom - yMid);
ctx.fillStyle = 'red'; // Low Y, High X
ctx.fillRect(xMid, yMid, chartArea.right - xMid, chartArea.bottom - yMid);
ctx.restore();
// Add labels to each point
chart.data.datasets.forEach((dataset, datasetIndex) => {
const meta = chart.getDatasetMeta(datasetIndex);
meta.data.forEach((element, index) => {
const dataPoint = dataset.data[index];
ctx.fillStyle = '#333';
ctx.font = 'bold 10px Arial';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillText(
`${dataPoint.label} (n=${dataPoint.count})`,
element.x,
element.y - element.options.radius - 8
);
});
});
}
}]
});
// Populate quadrant analysis lists
function populateQuadrants() {
const q1 = document.getElementById('q1-items'); // High Y, Low X
const q2 = document.getElementById('q2-items'); // High Y, High X
const q3 = document.getElementById('q3-items'); // Low Y, Low X
const q4 = document.getElementById('q4-items'); // Low Y, High X
data.forEach(item => {
const li = document.createElement('li');
li.innerHTML = `<strong>${item.type}</strong> (Y: ${item.yValue}, X: ${item.xValue}, Count: ${item.count})`;
// Determine quadrant (using 5 as midpoint)
if (item.yValue > 5 && item.xValue <= 5) {
q1.appendChild(li);
} else if (item.yValue > 5 && item.xValue > 5) {
q2.appendChild(li);
} else if (item.yValue <= 5 && item.xValue <= 5) {
q3.appendChild(li);
} else {
q4.appendChild(li);
}
});
// Add "None" message if quadrant is empty
[q1, q2, q3, q4].forEach(ul => {
if (ul.children.length === 0) {
const li = document.createElement('li');
li.textContent = 'None';
li.style.color = '#888';
ul.appendChild(li);
}
});
}
populateQuadrants();
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Doughnut Chart - Chart.js</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
</head>
<body>
<div class="chart-container">
<canvas id="myChart"></canvas>
</div>
<script>
// TODO: Replace with actual data
const data = {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
label: 'Dataset',
data: [300, 50, 100, 75, 125, 150],
backgroundColor: [
'rgba(255, 99, 132, 0.8)',
'rgba(54, 162, 235, 0.8)',
'rgba(255, 206, 86, 0.8)',
'rgba(75, 192, 192, 0.8)',
'rgba(153, 102, 255, 0.8)',
'rgba(255, 159, 64, 0.8)'
],
borderColor: [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 206, 86)',
'rgb(75, 192, 192)',
'rgb(153, 102, 255)',
'rgb(255, 159, 64)'
],
borderWidth: 2
}]
};
// TODO: Customize chart options
const config = {
type: 'doughnut',
data: data,
options: {
responsive: true,
maintainAspectRatio: true,
aspectRatio: 1.5,
plugins: {
title: {
display: true,
text: 'Doughnut Chart Title', // TODO: Customize title
font: {
size: 18,
weight: 'bold'
},
padding: 20
},
legend: {
display: true,
position: 'right',
labels: {
font: {
size: 12
},
padding: 15,
usePointStyle: true
}
},
tooltip: {
callbacks: {
label: function(context) {
let label = context.label || '';
if (label) {
label += ': ';
}
const value = context.parsed;
const total = context.dataset.data.reduce((a, b) => a + b, 0);
const percentage = ((value / total) * 100).toFixed(1);
label += value + ' (' + percentage + '%)';
return label;
}
}
}
}
}
};
// Create chart
const ctx = document.getElementById('myChart').getContext('2d');
const chart = new Chart(ctx, config);
</script>
</body>
</html>
/* MicroSim Iframe Template - Minimal Styling for Embedded Charts */
/*
* This template provides clean, minimal styling for MicroSims designed
* to be embedded in iframes within MkDocs documentation.
*
* Features:
* - No extra padding or margins for tight iframe embedding
* - Simple black text on white background
* - Responsive font sizing for mobile devices
* - Clean, professional appearance
*
* Usage:
* 1. Copy this file to your MicroSim directory
* 2. Customize colors, fonts, and spacing as needed
* 3. Link in your HTML: <link rel="stylesheet" href="style-iframe.css">
*/
/* Universal reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Body - base styles */
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: white;
color: #2c3e50;
line-height: 1.6;
padding: 0;
margin: 0;
}
/* Main container */
.container {
max-width: 100%;
margin: 0;
background: white;
overflow: hidden;
}
/* Header section */
.header {
background: white;
color: black;
padding: 5px 0px 2px 0px;
text-align: center;
}
/* Main title (h1) */
.header h1 {
font-size: 24px;
font-weight: 700;
margin: 0 0 2px 0;
color: black;
}
/* Subtitle text */
.subtitle {
font-size: 14px;
color: black;
font-weight: 300;
margin: 0;
padding: 0;
}
/* Chart/visualization container */
.chart-container {
padding: 0px;
background: white;
position: relative;
}
/* Canvas element (for Chart.js, p5.js, etc.) */
canvas {
display: block;
max-width: 100%;
}
/* Responsive design for mobile devices */
@media (max-width: 768px) {
.header h1 {
font-size: 20px;
}
.subtitle {
font-size: 12px;
}
}
/* Optional: Utility classes you can add as needed */
/* Add a subtle border below header */
.header-bordered {
border-bottom: 1px solid #dee2e6;
}
/* Alternative background color for container */
.container-light-bg {
background: #f8f9fa;
}
.container-blue-bg {
background: aliceblue;
}
/* Center content within chart container */
.chart-container-centered {
display: flex;
justify-content: center;
align-items: center;
}
/* Add minimal padding to chart container if needed */
.chart-container-padded {
padding: 10px;
}
/* Dark text variants */
.text-dark {
color: #212529;
}
.text-muted {
color: #6c757d;
}
/* Print styles - hide interactive elements when printing */
@media print {
body {
background: white;
padding: 0;
}
.container {
box-shadow: none;
}
/* Hide any buttons or interactive elements */
button,
.no-print {
display: none;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Task Completion Time Horizons</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
</head>
<body>
<div class="container">
<h1>AI Task Completion Time Horizons</h1>
<p class="subtitle">How long can AI models work on tasks before failing?</p>
<div class="legend">
<div class="legend-item">
<div class="legend-dot" style="background: #27ae60;"></div>
<span>Frontier Models</span>
</div>
<div class="legend-item">
<div class="legend-dot" style="background: #95a5a6;"></div>
<span>Non-Frontier Models</span>
</div>
</div>
<div class="chart-container">
<canvas id="taskChart"></canvas>
</div>
<div class="controls">
<div class="control-group">
<label>Scale:</label>
<div class="btn-group">
<button id="btnLinear" class="active" onclick="setScale('linear')">Linear</button>
<button id="btnLog" onclick="setScale('logarithmic')">Log</button>
</div>
</div>
<div class="control-group">
<label>Success Probability:</label>
<div class="btn-group">
<button id="btn50" class="active" onclick="setProbability('50')">50%</button>
<button id="btn80" onclick="setProbability('80')">80%</button>
</div>
<span class="info-tooltip" title="50% time horizon means we predict a 50% chance the model will successfully complete a task">?</span>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
/* ChartJS CSS file optimized for iframes with small margin and padding
Designed to fit in a 500px high frame with responsive width
<iframe src="main.html" height="500pt" width="100%" scrolling="no"></iframe>
*/
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: aliceblue;
border: solid blue 2px;
}
h1 {
text-align: center;
color: black;
margin-bottom: 2px;
font-size: 1.5em;
}
.subtitle {
text-align: center;
color: black;
margin-bottom: 2;
font-size: 0.9em;
}
.controls {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 5px;
margin-bottom: 0px;
flex-wrap: nowrap;
align-items: center;
}
.control-group {
display: flex;
gap: 5px;
align-items: center;
white-space: nowrap;
}
.control-group label {
font-weight: 600;
color: #34495e;
font-size: 0.9em;
}
.btn-group {
display: flex;
gap: 5px;
}
button {
padding: 2px 4px;
border: 2px solid #3498db;
background: white;
color: #3498db;
cursor: pointer;
border-radius: 2px;
font-weight: 600;
transition: all 0.3s ease;
font-size: 0.85em;
}
button:hover {
background: #ecf0f1;
transform: translateY(-1px);
}
button.active {
background: #3498db;
color: white;
}
.chart-container {
position: relative;
height: 500px;
}
.legend {
display: flex;
justify-content: center;
gap: 25px;
margin-bottom: 15px;
flex-wrap: wrap;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
font-size: 0.85em;
color: #555;
}
.legend-dot {
width: 12px;
height: 12px;
border-radius: 50%;
}
.info-tooltip {
display: inline-block;
width: 16px;
height: 16px;
background: #3498db;
color: white;
border-radius: 50%;
text-align: center;
line-height: 16px;
font-size: 11px;
cursor: help;
margin-left: 4px;
}
@media (max-width: 768px) {
.container {
padding: 15px;
}
h1 {
font-size: 1.2em;
}
.chart-container {
height: 390px;
}
.controls {
flex-wrap: wrap;
gap: 15px;
}
button {
padding: 6px 12px;
font-size: 0.8em;
}
}
[Chart Title]
[Brief description of what this chart visualizes]
Interactive Chart
<iframe src="main.html" width="100%" height="700" frameborder="0"></iframe>
View Fullscreen{:target="_blank"}
Overview
[Detailed explanation of what the chart shows and why it's useful]
Features
Interactive Elements
- Hover tooltips - Detailed data shown on hover
- Clickable legend - Show/hide datasets by clicking legend items
- Smooth animations - Chart animates on load and data updates
- Responsive - Adapts to different screen sizes
Visual Design
- Color-coded categories for easy identification
- Clear axis labels and grid lines
- Professional styling with shadows and gradients
- Print-friendly layout
Customization Guide
Changing the Data
To modify the chart data, edit the data object in main.html:
const data = {
labels: ['Your', 'Labels', 'Here'],
datasets: [{
label: 'Your Dataset',
data: [10, 20, 30, 40, 50]
}]
};Adjusting Colors
Customize the color scheme by modifying the backgroundColor and borderColor properties:
backgroundColor: [
'rgba(255, 99, 132, 0.8)',
'rgba(54, 162, 235, 0.8)',
'rgba(255, 206, 86, 0.8)',
// Add more colors as needed
]Tip: Use rgba() colors with alpha channel (0.0-1.0) for transparency.
Chart Title and Labels
Update the chart title and axis labels:
options: {
plugins: {
title: {
display: true,
text: 'Your Chart Title'
}
},
scales: {
x: {
title: {
display: true,
text: 'X-Axis Label'
}
},
y: {
title: {
display: true,
text: 'Y-Axis Label'
}
}
}
}Adjusting Chart Size
Modify the aspect ratio in the options object:
options: {
maintainAspectRatio: true,
aspectRatio: 2 // Width:height ratio (2 = twice as wide as tall)
}Or adjust the container height in style.css:
.chart-container {
height: 600px; /* Adjust as needed */
}Legend Position
Change where the legend appears:
options: {
plugins: {
legend: {
position: 'top' // Options: 'top', 'bottom', 'left', 'right'
}
}
}Technical Details
- Library: Chart.js 4.4.0
- Chart Type: [Line/Bar/Pie/etc.]
- Browser Compatibility: All modern browsers (Chrome, Firefox, Safari, Edge)
- Dependencies: Chart.js (loaded from CDN)
- Responsive: Yes, adapts to container width
- Mobile Friendly: Yes, optimized for touch devices
File Structure
[chart-name]/
├── main.html # Main chart implementation
├── style.css # Styling and layout
└── index.md # This documentation fileUse Cases
This [chart type] is particularly useful for:
- [Use case 1]
- [Use case 2]
- [Use case 3]
- [Use case 4]
References
Related Charts
- [Link to related chart 1]
- [Link to related chart 2]
---
Generated using the chartjs-generator skill
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Line Chart - Chart.js</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
</head>
<body>
<div class="chart-container">
<canvas id="myChart"></canvas>
</div>
<script>
// TODO: Replace with actual data
const data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{
label: 'Dataset 1',
data: [65, 59, 80, 81, 56, 55, 40],
borderColor: 'rgb(75, 192, 192)',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
tension: 0.1, // Line smoothness (0 = straight, 1 = very curved)
fill: true
}]
};
// TODO: Customize chart options
const config = {
type: 'line',
data: data,
options: {
responsive: true,
maintainAspectRatio: true,
aspectRatio: 2,
plugins: {
title: {
display: true,
text: 'Line Chart Title', // TODO: Customize title
font: {
size: 18,
weight: 'bold'
},
padding: 20
},
legend: {
display: true,
position: 'top',
labels: {
font: {
size: 12
},
usePointStyle: true
}
},
tooltip: {
mode: 'index',
intersect: false,
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
label += context.parsed.y.toFixed(2);
return label;
}
}
}
},
scales: {
x: {
title: {
display: true,
text: 'X-Axis Label', // TODO: Customize label
font: {
size: 14,
weight: 'bold'
}
},
grid: {
color: 'rgba(200, 200, 200, 0.2)'
}
},
y: {
title: {
display: true,
text: 'Y-Axis Label', // TODO: Customize label
font: {
size: 14,
weight: 'bold'
}
},
beginAtZero: true,
grid: {
color: 'rgba(200, 200, 200, 0.2)'
}
}
},
interaction: {
mode: 'nearest',
axis: 'x',
intersect: false
}
}
};
// Create chart
const ctx = document.getElementById('myChart').getContext('2d');
const chart = new Chart(ctx, config);
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pie Chart - Chart.js</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
</head>
<body>
<div class="chart-container">
<canvas id="myChart"></canvas>
</div>
<script>
// TODO: Replace with actual data
const data = {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
label: 'Dataset',
data: [300, 50, 100, 75, 125, 150],
backgroundColor: [
'rgba(255, 99, 132, 0.8)',
'rgba(54, 162, 235, 0.8)',
'rgba(255, 206, 86, 0.8)',
'rgba(75, 192, 192, 0.8)',
'rgba(153, 102, 255, 0.8)',
'rgba(255, 159, 64, 0.8)'
],
borderColor: [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 206, 86)',
'rgb(75, 192, 192)',
'rgb(153, 102, 255)',
'rgb(255, 159, 64)'
],
borderWidth: 2
}]
};
// TODO: Customize chart options
const config = {
type: 'pie', // Change to 'doughnut' for doughnut chart
data: data,
options: {
responsive: true,
maintainAspectRatio: true,
aspectRatio: 1.5,
plugins: {
title: {
display: true,
text: 'Pie Chart Title', // TODO: Customize title
font: {
size: 18,
weight: 'bold'
},
padding: 20
},
legend: {
display: true,
position: 'right',
labels: {
font: {
size: 12
},
padding: 15,
usePointStyle: true
}
},
tooltip: {
callbacks: {
label: function(context) {
let label = context.label || '';
if (label) {
label += ': ';
}
const value = context.parsed;
const total = context.dataset.data.reduce((a, b) => a + b, 0);
const percentage = ((value / total) * 100).toFixed(1);
label += value + ' (' + percentage + '%)';
return label;
}
}
}
}
}
};
// Create chart
const ctx = document.getElementById('myChart').getContext('2d');
const chart = new Chart(ctx, config);
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Polar Area Chart - Chart.js</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
</head>
<body>
<div class="chart-container">
<canvas id="myChart"></canvas>
</div>
<script>
// TODO: Replace with actual data
const data = {
labels: ['Red', 'Green', 'Yellow', 'Grey', 'Blue'],
datasets: [{
label: 'Dataset',
data: [11, 16, 7, 3, 14],
backgroundColor: [
'rgba(255, 99, 132, 0.7)',
'rgba(75, 192, 192, 0.7)',
'rgba(255, 206, 86, 0.7)',
'rgba(201, 203, 207, 0.7)',
'rgba(54, 162, 235, 0.7)'
],
borderColor: [
'rgb(255, 99, 132)',
'rgb(75, 192, 192)',
'rgb(255, 206, 86)',
'rgb(201, 203, 207)',
'rgb(54, 162, 235)'
],
borderWidth: 2
}]
};
// TODO: Customize chart options
const config = {
type: 'polarArea',
data: data,
options: {
responsive: true,
maintainAspectRatio: true,
aspectRatio: 1.5,
plugins: {
title: {
display: true,
text: 'Polar Area Chart Title', // TODO: Customize title
font: {
size: 18,
weight: 'bold'
},
padding: 20
},
legend: {
display: true,
position: 'top',
labels: {
font: {
size: 12
},
padding: 15,
usePointStyle: true
}
},
tooltip: {
callbacks: {
label: function(context) {
let label = context.label || '';
if (label) {
label += ': ';
}
label += context.parsed.r.toFixed(2);
return label;
}
}
}
},
scales: {
r: {
beginAtZero: true,
ticks: {
backdropColor: 'rgba(255, 255, 255, 0.75)'
},
grid: {
color: 'rgba(200, 200, 200, 0.3)'
}
}
}
}
};
// Create chart
const ctx = document.getElementById('myChart').getContext('2d');
const chart = new Chart(ctx, config);
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Radar Chart - Chart.js</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
</head>
<body>
<div class="chart-container">
<canvas id="myChart"></canvas>
</div>
<script>
// TODO: Replace with actual data
const data = {
labels: ['Strength', 'Speed', 'Intelligence', 'Endurance', 'Accuracy', 'Teamwork'],
datasets: [{
label: 'Player 1',
data: [65, 59, 90, 81, 56, 55],
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgb(255, 99, 132)',
pointBackgroundColor: 'rgb(255, 99, 132)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgb(255, 99, 132)',
borderWidth: 2
}, {
label: 'Player 2',
data: [28, 48, 40, 19, 96, 27],
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgb(54, 162, 235)',
pointBackgroundColor: 'rgb(54, 162, 235)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgb(54, 162, 235)',
borderWidth: 2
}]
};
// TODO: Customize chart options
const config = {
type: 'radar',
data: data,
options: {
responsive: true,
maintainAspectRatio: true,
aspectRatio: 1.5,
plugins: {
title: {
display: true,
text: 'Radar Chart Title', // TODO: Customize title
font: {
size: 18,
weight: 'bold'
},
padding: 20
},
legend: {
display: true,
position: 'top',
labels: {
font: {
size: 12
},
usePointStyle: true
}
},
tooltip: {
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
label += context.parsed.r.toFixed(2);
return label;
}
}
}
},
scales: {
r: {
beginAtZero: true,
max: 100, // TODO: Adjust max value
ticks: {
stepSize: 20
},
grid: {
color: 'rgba(200, 200, 200, 0.3)'
},
angleLines: {
color: 'rgba(200, 200, 200, 0.3)'
},
pointLabels: {
font: {
size: 12
}
}
}
}
}
};
// Create chart
const ctx = document.getElementById('myChart').getContext('2d');
const chart = new Chart(ctx, config);
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Scatter Chart - Chart.js</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
</head>
<body>
<div class="chart-container">
<canvas id="myChart"></canvas>
</div>
<script>
// TODO: Replace with actual data
const data = {
datasets: [{
label: 'Dataset 1',
data: [
{ x: -10, y: 0 },
{ x: 0, y: 10 },
{ x: 10, y: 5 },
{ x: 0.5, y: 5.5 },
{ x: -5, y: -5 },
{ x: 8, y: 2 }
],
backgroundColor: 'rgba(255, 99, 132, 0.8)',
borderColor: 'rgb(255, 99, 132)',
pointRadius: 6,
pointHoverRadius: 8
}, {
label: 'Dataset 2',
data: [
{ x: -8, y: -2 },
{ x: -2, y: 8 },
{ x: 7, y: -3 },
{ x: 3, y: 7 },
{ x: -3, y: 3 }
],
backgroundColor: 'rgba(54, 162, 235, 0.8)',
borderColor: 'rgb(54, 162, 235)',
pointRadius: 6,
pointHoverRadius: 8
}]
};
// TODO: Customize chart options
const config = {
type: 'scatter',
data: data,
options: {
responsive: true,
maintainAspectRatio: true,
aspectRatio: 1.5,
plugins: {
title: {
display: true,
text: 'Scatter Chart Title', // TODO: Customize title
font: {
size: 18,
weight: 'bold'
},
padding: 20
},
legend: {
display: true,
position: 'top',
labels: {
font: {
size: 12
},
usePointStyle: true
}
},
tooltip: {
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
label += '(' + context.parsed.x.toFixed(2) + ', ' + context.parsed.y.toFixed(2) + ')';
return label;
}
}
}
},
scales: {
x: {
type: 'linear',
position: 'bottom',
title: {
display: true,
text: 'X-Axis Label', // TODO: Customize label
font: {
size: 14,
weight: 'bold'
}
},
grid: {
color: 'rgba(200, 200, 200, 0.2)'
}
},
y: {
title: {
display: true,
text: 'Y-Axis Label', // TODO: Customize label
font: {
size: 14,
weight: 'bold'
}
},
grid: {
color: 'rgba(200, 200, 200, 0.2)'
}
}
}
}
};
// Create chart
const ctx = document.getElementById('myChart').getContext('2d');
const chart = new Chart(ctx, config);
</script>
</body>
</html>
/* This CSS has been modified to fit in an iframe with minimal margins and padding
/* Reset and base styles */
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 0;
}
/* Chart container */
.chart-container {
position: relative;
width: 100%;
height: 500px;
background: aliceblue;
}
/* Do not put any analysis in the iframe version */
/* Optional analysis/legend container */
.analysis-container {
background: aliceblue;
padding: 0px;
}
.analysis-container h3 {
margin-bottom: 20px;
color: #2c3e50;
font-size: 1.4em;
border-bottom: 3px solid #3498db;
padding-bottom: 10px;
}
/* Section styling */
.section {
margin-bottom: 20px;
background: white;
border-radius: 6px;
padding: 15px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.section-label {
font-weight: bold;
font-size: 1.1em;
margin-bottom: 10px;
padding: 8px 12px;
border-radius: 4px;
background: linear-gradient(135deg, #3498db, #5dade2);
color: white;
}
/* List styling */
.section ul {
list-style: none;
padding-left: 0;
}
.section li {
padding: 8px 12px;
margin: 5px 0;
background: #f8f9fa;
border-left: 4px solid #3498db;
border-radius: 3px;
font-size: 0.95em;
transition: all 0.2s ease;
}
.section li:hover {
background: #e8f4f8;
transform: translateX(5px);
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.section li strong {
color: #2c3e50;
font-size: 1.05em;
}
/* Responsive design */
@media (max-width: 768px) {
body {
padding: 10px;
}
.chart-container {
height: 400px;
padding: 10px;
}
.analysis-container {
padding: 15px;
}
.analysis-container h3 {
font-size: 1.2em;
}
.section-label {
font-size: 1em;
}
.section li {
font-size: 0.9em;
}
}
/* Print styles */
@media print {
.chart-container {
box-shadow: none;
page-break-inside: avoid;
}
.analysis-container {
box-shadow: none;
}
.section {
page-break-inside: avoid;
}
}