定制 jringeisen/wirecharts 二次开发

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

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

jringeisen/wirecharts

Composer 安装命令:

composer create-project jringeisen/wirecharts

包简介

A package that allows you to integrate charts with your livewire application.

README 文档

README

After using Laravel Nova in a handful of projects, I needed the Value and Trend Cards outside of Laravel Nova. So I decided to build a livewire package that uses Chartist.js library to accomplish this. Wire Charts trend card

Installation

To get started with Wire Charts, you'll need to require the package.

composer require jringeisen/wirecharts

Add Chartist.js Assets

You'll need the chartist.js assets, make sure to include these in the head of your layout.

<link rel="stylesheet" href="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.css">
<script src="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.js"></script>

Publish Views

If you'd like to make modifications to the views, you can do so by using the following command.

php artisan vendor:publish --provider="Jringeisen\WireCharts\WireChartsServiceProvider" --tag="views"

Adding the chart component

To display a chart you'll want to add the component of the chart that you want to add. So for instance, this is how you would add a line chart.

@livewire('line-chart', ['chartId' => '1', 'title' => 'Daily Users', 'series' => $data1, 'height' => 'h-36'])

If you plan to have multiple charts on the same page, make sure to have a unique chartId for each chart, like so.

@livewire('line-chart', ['chartId' => '1', 'title' => 'Daily Users', 'series' => $data1, 'height' => 'h-36'])
@livewire('line-chart', ['chartId' => '2', 'title' => 'Unique Visitors', 'series' => $data2, 'height' => 'h-36'])

The series option requires a specific format.

$data1 = [
    'count' => 100,
    'data' => [
        ['meta' => '2021-01-01', 'value' => 5],
        ['meta' => '2021-01-02', 'value' => 4],
        ['meta' => '2021-01-03', 'value' => 1]
    ]
]

License

Wire Charts is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固