Skip to content

Commit f0c1761

Browse files
committed
添加 折线图
添加 面积图 添加 阶梯图 添加 条形图 添加vue组件分包加载
1 parent 3313d1f commit f0c1761

38 files changed

+1105
-46
lines changed

.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"plugins": [
3+
34
[
45
"import",
56
{
184 KB
Loading
45.8 KB
Loading
44.1 KB
Loading
16.9 KB
Loading
19.4 KB
Loading

docs/components.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Card::make()->content();
2222

2323
引导用户按照流程完成任务的分步导航条,可根据实际应用场景设定步骤,步骤不得少于 2 步。
2424

25+
![image-20200330135622182](components.assets/image-20200330135622182.png)
26+
2527
```php
2628
Steps::make()
2729
->simple(false)
@@ -72,6 +74,8 @@ Text::make()->html("我是纯文本");
7274

7375
用于页面中展示重要的提示信息。
7476

77+
![image-20200330135556270](components.assets/image-20200330135556270.png)
78+
7579
```
7680
Alert::make("title","desc");
7781
```
@@ -472,3 +476,86 @@ Transfer::make()->data($permissionModel::get()->map(function ($item) {
472476

473477

474478

479+
## 统计图表
480+
481+
g2plot 是一套简单、易用、并具备一定扩展能力和组合能力的统计图表库,基于图形语法理论搭建而成,"g2plot"中的 g2 即意指图形语法 (the Gramma of Graphics),同时也致敬了 ggplot2。
482+
483+
![image-20200330151604231](components.assets/image-20200330151604231.png)
484+
485+
### Line - 折线图
486+
487+
使用一条折线的线段显示数据在一个具有顺序性的维度上的变化。
488+
489+
![image-20200330154928558](components.assets/image-20200330154928558.png)
490+
491+
```php
492+
Line::make()
493+
->data(function () {
494+
$data = collect();
495+
for ($year = 2010; $year <= 2020; $year++) {
496+
$data->push([
497+
'year' => (string)$year,
498+
'type'=>'type1',
499+
'value' => rand(100, 1000)
500+
]);
501+
$data->push([
502+
'year' => (string)$year,
503+
'type'=>'type2',
504+
'value' => rand(100, 1000)
505+
]);
506+
}
507+
return $data;
508+
})
509+
->config(function () {
510+
return [
511+
'title' => [
512+
'visible' => true,
513+
'text' => '折线图',
514+
],
515+
'seriesField'=>'type',
516+
'smooth'=>true,
517+
'xField' => 'year',
518+
'yField' => 'value'
519+
];
520+
});
521+
```
522+
523+
具体请参考:https://g2plot.antv.vision/zh/examples/line/basic
524+
525+
### StepLine - 阶梯折图
526+
527+
阶梯线图用于表示连续时间跨度内的数据,它通常用于显示某变量随时间的变化模式:是上升还是下降,是否存在周期性的循环?因此,相对于独立的数据点,折线图关注的是全局趋势。
528+
529+
![image-20200330161859300](components.assets/image-20200330161859300.png)
530+
531+
```php
532+
StepLine::make()->data()->config();
533+
```
534+
535+
具体参数请参考:https://g2plot.antv.vision/zh/examples/step-line/basic
536+
537+
### Area - 面积图
538+
539+
面积图又叫区域图。 它是在折线图的基础之上形成的,它将折线图中折线与自变量坐标轴之间的区域使用颜色或者纹理填充,这样一个填充区域我们叫做面积,颜色的填充可以更好的突出趋势信息。
540+
541+
面积图用于强调数量随时间而变化的程度,也可用于引起人们对总值趋势的注意。他们最常用于表现趋势和关系,而不是传达特定的值。
542+
543+
![image-20200330154940875](components.assets/image-20200330154940875.png)
544+
545+
```php
546+
Area::make()->data()->config();
547+
```
548+
549+
具体参数请参考:https://g2plot.antv.vision/zh/examples/area/basic
550+
551+
### Column - 柱状图
552+
553+
柱状图用于描述分类数据之间的对比,如果我们把时间周期,如周、月、年,也理解为一种分类数据 (time category),那么柱状图也可以用于描述时间周期之间的数值比较。
554+
555+
![image-20200330162019246](components.assets/image-20200330162019246.png)
556+
557+
```php
558+
Column::make()->data()->config();
559+
```
560+
561+
具体参数请参考:https://g2plot.antv.vision/zh/examples/column/basic

docs/grid.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,13 @@ $column->headerAlign('right');
525525
$column->help('帮助内容');
526526
```
527527

528+
### 设置默认值
529+
530+
当获取不到字段值的时候显示的内容,默认为`null`
531+
532+
```php
533+
$column->defaultValue("-")
534+
```
528535

529536
### 显示组件
530537

@@ -545,10 +552,23 @@ $column->component(Tag::make()->size("mini")->type("info"));
545552
支持HTML标签
546553

547554
```php
555+
//普通
548556
$grid->column('name')->customValue(function ($row, $value) {
549557
return $value;
550-
})
558+
});
559+
//一对一
560+
$grid->column('user.name')->customValue(function ($row, $value) {
561+
//此时的value是name的值
562+
return $value;
563+
});
564+
//一对多
565+
$grid->column('roles.name')->customValue(function ($row, $value) {
566+
//此时的value是 roles.name的值的数组
567+
return $value;
568+
});
551569
```
570+
571+
552572
### 前缀/后缀
553573

554574
会在值的前后以字符串形式拼接
@@ -589,7 +609,7 @@ $grid->column('permissions.name'),
589609
#### 一对多
590610
一对多最终得到的是数组,前端会自动循环展示,文本建议使用`Tag`组件,图片建议使用`Avatar``Image`组件
591611
```php
592-
$grid->column('permissions.name')->displayComponent(Tag::make()->type('info')),
612+
$grid->column('permissions.name')->component(Tag::make()->type('info')),
593613
```
594614

595615

0 commit comments

Comments
 (0)