承接 maantje/charts 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

maantje/charts

Composer 安装命令:

composer require maantje/charts

包简介

SVG Charts in PHP

README 文档

README

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.

Features

  • Simple, intuitive API for chart creation
  • Lightweight, with no external dependencies
  • Supports various chart types: line charts, bar charts, stacked charts, and mixed charts
  • Fully customizable and extendable
  • Outputs pure SVG, allowing for:

Installation

To get started, install the package via composer:

composer require maantje/charts

Usage Examples

Below 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.

Example Usage With mPDF

📄 View PDF document
View source

Simple Line Chart

Simple Line Chart
View source

Curved Line Chart

Curved Line Chart
View source

Step line chart

Step line chart
View source

Area line chart

Area line chart
View source

Bar Chart

Bar Chart
View source

Stacked Bar Chart

Stacked Bar Chart
View source

Grouped Bar Chart

Grouped Bar Chart
View source

Advanced Line Chart

Advanced Line Chart
View source

Advanced Bar Chart

Advanced Bar Chart
View source

Mixed chart

Mixed chart
View source

Negative Values Chart

Negative Values Chart
View source

Pie chart

Pie chart
View source

Usage

Creating a Chart

You 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.

Simple Bar Chart

use Maantje\Charts\Bar\Bar;
use Maantje\Charts\Bar\Bars;
use Maantje\Charts\Chart;

$chart = new Chart(
    series: [
        new Bars(
            bars: [
                new Bar(name: 'Jan', value: 222301),
                new Bar(name: 'Feb', value: 189242),
                new Bar(name: 'Mar', value: 144922),
            ],
        ),
    ],
);

echo $chart->render();

Simple Line Chart

use Maantje\Charts\Chart;
use Maantje\Charts\Line\Line;
use Maantje\Charts\Line\Lines;
use Maantje\Charts\Line\Point;

$chart = new Chart(
    series: [
        new Lines(
            lines: [
                new Line(
                    points: [
                        new Point(x: 0, y: 0),
                        new Point(x: 100, y: 4),
                        new Point(x: 200, y: 12),
                        new Point(x: 300, y: 8),
                    ],
                ),
                new Line(
                    points: [
                        [0, 0],
                        [100, 4],
                        [200, 12],
                        [300, 8],
                    ],
                ),
            ],
        ),
    ],
);

echo $chart->render();

Annotations

You can add annotations to your charts for better visualization.

use Maantje\Charts\Annotations\PointAnnotation;
use Maantje\Charts\YAxis;

$chart = new Chart(
    yAxis: new YAxis(
        annotations: [
            new PointAnnotation(x: 200, y: 120, label: 'Important Point'),
        ],
    ),
    // ...
);

License

The MIT License (MIT). Please see License File for more information.

maantje/charts 适用场景与选型建议

maantje/charts 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 118.6k 次下载、GitHub Stars 达 331, 最近一次更新时间为 2024 年 09 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 maantje/charts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 maantje/charts 我们能提供哪些服务?
定制开发 / 二次开发

基于 maantje/charts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 118.6k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 332
  • 点击次数: 14
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 331
  • Watchers: 9
  • Forks: 13
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-04