{"id":30746738,"url":"https://github.com/maantje/charts","last_synced_at":"2025-10-19T15:02:26.095Z","repository":{"id":255445531,"uuid":"851751183","full_name":"maantje/charts","owner":"maantje","description":"Make SVG charts with PHP","archived":false,"fork":false,"pushed_at":"2025-08-09T15:57:53.000Z","size":952,"stargazers_count":310,"open_issues_count":3,"forks_count":10,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-09-29T02:39:42.399Z","etag":null,"topics":["chart","charts","php","svg"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maantje.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-03T16:40:30.000Z","updated_at":"2025-09-28T09:12:40.000Z","dependencies_parsed_at":"2024-09-06T02:44:30.521Z","dependency_job_id":null,"html_url":"https://github.com/maantje/charts","commit_stats":null,"previous_names":["maantje/charts"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/maantje/charts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maantje%2Fcharts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maantje%2Fcharts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maantje%2Fcharts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maantje%2Fcharts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maantje","download_url":"https://codeload.github.com/maantje/charts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maantje%2Fcharts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279836162,"owners_count":26233623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-19T02:00:07.647Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chart","charts","php","svg"],"created_at":"2025-09-04T04:27:37.273Z","updated_at":"2025-10-19T15:02:26.086Z","avatar_url":"https://github.com/maantje.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Charts - SVG Chart Rendering\n\n**Charts** is a zero-dependency PHP library for generating SVG charts. It enables easy creation of SVG-based charts directly from PHP, with no additional dependencies required.\n\n## Features\n\n- Simple, intuitive API for chart creation\n- Lightweight, with no external dependencies\n- Supports various chart types: line charts, bar charts, stacked charts, and mixed charts\n- Fully customizable and extendable\n- Outputs pure SVG, allowing for:\n  - Embedding in PDFs, [view example PDF report](https://raw.githubusercontent.com/maantje/charts/refs/heads/main/examples/output/report.pdf)\n\n## Installation\n\nTo get started, install the package via composer:\n\n```bash\ncomposer require maantje/charts\n```\n\n## Usage Examples\n\nBelow are some examples of the types of charts you can create using this library. Click on the links to view the source code for each example.\n\n- [Example Usage With mPDF](#example-usage-with-mpdf)\n- [Simple Line Chart](#simple-line-chart)\n- [Curved Line Chart](#curved-line-chart)\n- [Step Line Chart](#step-line-chart)\n- [Area Line Chart](#area-line-chart)\n- [Bar Chart](#bar-chart)\n- [Stacked Bar Chart](#stacked-bar-chart)\n- [Grouped Bar Chart](#grouped-bar-chart)\n- [Advanced Line Chart](#advanced-line-chart)\n- [Advanced Bar Chart](#advanced-bar-chart)\n- [Mixed Chart](#mixed-chart)\n- [Pie Chart](#pie-chart)\n\n### Example Usage With mPDF\n[📄 View PDF document](https://raw.githubusercontent.com/maantje/charts/refs/heads/main/examples/output/report.pdf)  \n[View source](./examples/pdf/mpdf.php)\n\n### Simple Line Chart\n![Simple Line Chart](./examples/output/line-chart.svg)  \n[View source](./examples/line-chart.php)\n\n### Curved Line Chart\n![Curved Line Chart](./examples/output/curved-line-chart.svg)  \n[View source](./examples/curved-line-chart.php)\n\n### Step line chart\n![Step line chart](./examples/output/step-line-chart.svg)  \n[View source](./examples/step-line-chart.php)\n\n### Area line chart\n![Area line chart](./examples/output/area-line-chart.svg)  \n[View source](./examples/area-line-chart.php)\n\n### Bar Chart\n![Bar Chart](./examples/output/bar-chart.svg)  \n[View source](./examples/bar-chart.php)\n\n### Stacked Bar Chart\n![Stacked Bar Chart](./examples/output/stacked-bar-chart.svg)  \n[View source](./examples/stacked-bar-chart.php)\n\n### Grouped Bar Chart\n![Grouped Bar Chart](./examples/output/grouped-bar-chart.svg)  \n[View source](./examples/grouped-bar-chart.php)\n\n### Advanced Line Chart\n![Advanced Line Chart](./examples/output/advanced-line-chart.svg)  \n[View source](./examples/advanced-line-chart.php)\n\n### Advanced Bar Chart\n![Advanced Bar Chart](./examples/output/advanced-bar-chart.svg)  \n[View source](./examples/advanced-bar-chart.php)\n\n### Mixed chart\n![Mixed chart](./examples/output/mixed-chart.svg)  \n[View source](./examples/mixed-chart.php)\n\n### Pie chart\n![Pie chart](./examples/output/pie-chart.svg)  \n[View source](./examples/pie-chart.php)\n\n## Usage\n\n### Creating a Chart\n\nYou can create different types of charts using the provided classes. Below are examples of how to create a simple bar chart and a line chart.\n\n#### Simple Bar Chart\n\n```php\nuse Maantje\\Charts\\Bar\\Bar;\nuse Maantje\\Charts\\Bar\\Bars;\nuse Maantje\\Charts\\Chart;\n\n$chart = new Chart(\n    series: [\n        new Bars(\n            bars: [\n                new Bar(name: 'Jan', value: 222301),\n                new Bar(name: 'Feb', value: 189242),\n                new Bar(name: 'Mar', value: 144922),\n            ],\n        ),\n    ],\n);\n\necho $chart-\u003erender();\n```\n\n#### Simple Line Chart\n\n```php\nuse Maantje\\Charts\\Chart;\nuse Maantje\\Charts\\Line\\Line;\nuse Maantje\\Charts\\Line\\Lines;\nuse Maantje\\Charts\\Line\\Point;\n\n$chart = new Chart(\n    series: [\n        new Lines(\n            lines: [\n                new Line(\n                    points: [\n                        new Point(x: 0, y: 0),\n                        new Point(x: 100, y: 4),\n                        new Point(x: 200, y: 12),\n                        new Point(x: 300, y: 8),\n                    ],\n                ),\n                new Line(\n                    points: [\n                        [0, 0],\n                        [100, 4],\n                        [200, 12],\n                        [300, 8],\n                    ],\n                ),\n            ],\n        ),\n    ],\n);\n\necho $chart-\u003erender();\n```\n\n#### Annotations\n\nYou can add annotations to your charts for better visualization.\n\n```php\nuse Maantje\\Charts\\Annotations\\PointAnnotation;\nuse Maantje\\Charts\\YAxis;\n\n$chart = new Chart(\n    yAxis: new YAxis(\n        annotations: [\n            new PointAnnotation(x: 200, y: 120, label: 'Important Point'),\n        ],\n    ),\n    // ...\n);\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaantje%2Fcharts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaantje%2Fcharts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaantje%2Fcharts/lists"}