Wikfit

使用 wikift 系统的 wikift-contributio

2018-02-09  本文已影响38人  qianmoQ

wikift-contribution-charts 是一套angular2开发的用于显示用户分享的图表, 先看一下效果:

image.png

是不是有些类似于 GitHub 的 commit 记录呢? wikift-contribution-charts 使用方式很简单, 数据结构也不是很繁琐, 纳闷我们先看一下如何使用该组件?

"wikift-contribution-charts": "^1.0.0" 
npm install
import { WikiftContributionModule } from 'wikift-contribution';

@NgModule({
   imports: [
        ...,
        WikiftContributionModule,
        ...
    ],
    exports: [],
    declarations: [
    ],
    providers: [
    ],
})
<wikift-contribution [data]="data"></wikift-contribution>
{
    "data": [
        {
            "date": 1514736000000,
            "details": [
                {
                    "name": null,
                    "date": 1546185600000,
                    "value": 0
                }
            ],
            "total": 0
        },
        {
            "date": 1514822400000,
            "details": [
                {
                    "name": null,
                    "date": 1546185600000,
                    "value": 0
                }
            ],
            "total": 0
        },
        {
            "date": 1514908800000,
            "details": [
                {
                    "name": null,
                    "date": 1546185600000,
                    "value": 0
                }
            ],
            "total": 0
        },
        {
            "date": 1514995200000,
            "details": [
                {
                    "name": null,
                    "date": 1546185600000,
                    "value": 0
                }
            ],
            "total": 0
        },
        {
            "date": 1515081600000,
            "details": [
                {
                    "name": null,
                    "date": 1546185600000,
                    "value": 0
                }
            ],
            "total": 0
        },
        {
            "date": 1515168000000,
            "details": [
                {
                    "name": null,
                    "date": 1546185600000,
                    "value": 0
                }
            ],
            "total": 0
        },
        {
            "date": 1515254400000,
            "details": [
                {
                    "name": null,
                    "date": 1546185600000,
                    "value": 0
                }
            ],
            "total": 0
        },
        {
            "date": 1515340800000,
            "details": [
                {
                    "name": null,
                    "date": 1546185600000,
                    "value": 0
                }
            ],
            "total": 0
        },
        {
            "date": 1515427200000,
            "details": [
                {
                    "name": null,
                    "date": 1546185600000,
                    "value": 0
                }
            ],
            "total": 0
        },
        {
            "date": 1515513600000,
            "details": [
                {
                    "name": null,
                    "date": 1546185600000,
                    "value": 0
                }
            ],
            "total": 0
        }
    ]
}

此时访问页面即可看到展示效果

上一篇下一篇

猜你喜欢

热点阅读