wayeet / c3js-php
c3js 的包装库,用于在 PHP(所有版本)中同步使用(
)
dev-main
2024-09-03 20:28 UTC
Requires
- php: *
This package is auto-updated.
Last update: 2024-09-03 20:28:43 UTC
README
PHP 包装器 für C3js 基于 D3。几年前写的,现在决定将其导入 GH 并公开发布。绝对处于工作状态,但最重要的图表已实现。
开始使用 c3js-php
- 使用 composer 安装包
composer require wayeet/c3js-php:dev-main
当包在某段时间完成后,您可以将 :dev-main 停止使用,因为它将进入稳定...
- 在 PHP 文件的顶部导入 autoload-文件(如果这是您项目中第一个 composer 包)
require_once __DIR__ . "/vendor/autoload.php";
- 通过调用 "Includer" 导入 css 和 js 依赖项。includeALL 方法直接将所有必要的代码注入到 head 标签中
<head> <?php> $includer = new Util\Includer(); $includer->includeALL(); ?> </head>
- 开始使用图表。例如,BarChart 类
<?php $demoData = [ ['data1', 30, 200, 100, 400, 150, 250], ['data2', 130, 100, 140, 200, 150, 50] ]; $chart = new C3Charts\BarChart("test", $demoData, true); $chart->preRender(); $chart->render(); ?>
文档
tdb