AI SummaryA Copilot instruction set for developing and maintaining the Chart.js trendline plugin, providing coding guidelines, project structure, and workflow tips for linear regression visualization in charts.
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to add the "chartjs-plugin-trendline — Copilot Instructions" prompt rules to my project. Repository: https://github.com/Makanz/chartjs-plugin-trendline Please read the repo to find the rules/prompt file, then: 1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type) 2. If there's an existing rules file, merge the new rules in rather than overwriting 3. Confirm what was added
Description
This plugin draws an linear trendline in your Chart. Made for Chart.js > 4.0
Chart.js Plugin Trendline — Agent Instructions
This plugin adds trendline support to Chart.js charts. It fits a linear regression model to datasets and draws trendlines over bar or line charts.
Project Structure
• Root: • package.json, webpack.config.js, example/*.html • Source (src/): • index.js — Entry point • components/ — Rendering logic (label.js, trendline.js) • core/ — Plugin definition (plugin.js) • utils/ — Math and drawing helpers (drawing.js, lineFitter.js)
Coding Guidelines
• Use modern JavaScript (ES6+) • Indent with 2 spaces • Use JSDoc for public methods (Google style) • Ensure compatibility with Chart.js v4+ • Name files/functions descriptively (no abbreviations)
File Notes
• plugin.js: Main plugin lifecycle integration • trendline.js: Handles drawing trendlines • lineFitter.js: Performs regression math • example/*.html: Demo charts — manually verify after changes
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster
Works With
Any AI assistant that accepts custom rules or system prompts