定制 beastbytes/mermaid-pie-chart 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

beastbytes/mermaid-pie-chart

Composer 安装命令:

composer require beastbytes/mermaid-pie-chart

包简介

PHP for Mermaid.js pie charts

README 文档

README

PHP for Mermaid.js pie charts.

For license information see the LICENSE file.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist beastbytes/mermaid-pie-chart

or add

"beastbytes/mermaid-pie-chart": "{{versionConstraint}}"

to the require section of your composer.json.

Usage

  • Create a PieChart instance using the Mermaid::create() method
  • Configure the chart
  • Render the chart

Example

/** @var array<string, float|int> $values */
echo Mermaid::create(PieChart::class)
    ->withValues($values)
    ->render()
;

API

PieChart

PieChart represents a pie chart.

addValues()

Returns a new instance of PieChart with the given values added to any existing values.

Note: New values with the same name as existing values will overwrite the existing values.

Parameters
Name Type Description
values array<string, float|int> Array of name => value pairs
Return Type: PieChart

render()

Returns a string that is the Mermaid Pie Chart wrapped in a HTML <pre class="mermaid"> tag.

Parameters
Name Type Description
attributes array<string, string> Array of attribute => value pairs
Note: The mermaid class is always added.

Return Type: string

showData()

Returns a new instance of PieChart with showData set. The rendered Pie Chart will show values after the legend text.

Return Type: PieChart

withComment()

Returns a new instance of PieChart with a comment.

Parameters
Name Type Description
comment string The comment
Return Type: PieChart

withTitle()

Returns a new instance of PieChart with a title.

Parameters
Name Type Description
title string The title
Return Type: PieChart

withValues()

Returns a new instance of PieChart with the given values.

Parameters
Name Type Description
values array<string, float|int> Array of name => value pairs
Return Type: PieChart

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2023-12-29