PHPackages                             antishov/yii2-morrisjs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. antishov/yii2-morrisjs

AbandonedArchivedYii2-extension[Utility &amp; Helpers](/categories/utility)

antishov/yii2-morrisjs
======================

v1.1.2(7y ago)36.8k4MITPHPPHP &gt;=5.5

Since Jun 17Pushed 7y ago1 watchersCompare

[ Source](https://github.com/antishov/yii2-morrisjs)[ Packagist](https://packagist.org/packages/antishov/yii2-morrisjs)[ RSS](/packages/antishov-yii2-morrisjs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

yii2-morrisjs
=============

[](#yii2-morrisjs)

[![Build Status](https://camo.githubusercontent.com/873ee4d6d9005d3002141636f8b9083465d5bc0d762a0a796bc21346911381d0/68747470733a2f2f7472617669732d63692e6f72672f616e746973686f762f796969322d6d6f727269736a732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/antishov/yii2-morrisjs)

This is the [MorrisJS](http://morrisjs.github.io/morris.js/index.html) widget. It's a very simple API for drawing line and bar charts.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/). Check the [composer.json](https://github.com/antishov/yii2-morrisjs/blob/master/composer.json) for this extension's requirements and dependencies.

To install, either run

```
$ composer require antishov/yii2-morrisjs

```

or add

```
"antishov/yii2-morrisjs": "@stable"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

### Line Chart

[](#line-chart)

#### Example of code

[](#example-of-code)

```
use antishov\Morris;
use yii\web\JsExpression;

echo Morris\Line::widget([
     'resize' => true,
     'gridTextSize' => 11,
     'element' => 'lineChart',
     'data' => [
         ['date' => '2017-06-14', 'value' => 2],
         ['date' => '2017-06-15', 'value' => 4],
         ['date' => '2017-06-16', 'value' => 1]
     ],
     'xKey' => 'date',
     'yKeys' => ['value'],
     'labels' => ['Impressions'],
     'xLabels' => 'day',
     'yLabelFormat' => new JsExpression(
         'function (y) {if (y === parseInt(y, 10)) {return y;}else {return "";}}'
     ),
     'yMin' => 'auto 40',
     'lineColors' => ['rgb(123, 204, 221)'],
     'pointFillColors' => ['rgb(82, 188, 211)'],
 ]);
```

#### Properties

[](#properties)

`resize` - Set to `true` to enable automatic resizing when the containing element resizes. (default: `false`). This has a significant performance impact, so is disabled by default.

`gridTextSize` - Set the point size of the axis labels (default: `12`).

`element` - Identifier that will be assigned to the chart.

`data` - The data to plot. This is an array of objects, containing x and y attributes as described by the xkey and ykeys options.

`xKey` - A string containing the name of the attribute that contains date (X) values (see available formats at [spec](http://morrisjs.github.io/morris.js/lines.html)).

`yKeys` - A list of strings containing names of attributes that contain Y values (one for each series of data to be plotted).

`labels` - A list of strings containing labels for the data series to be plotted (corresponding to the values in the `ykeys` option).

`xLabels` - Sets the x axis labelling interval. By default the interval will be automatically computed (see valid interval strings at [spec](http://morrisjs.github.io/morris.js/lines.html)).

`yLabelFormat` - function that accepts y-values and formats them for display as y-axis labels.

`yMin` - Min. bound for Y-values. Alternatively, set this to `'auto'` to compute automatically, or `'auto [num]'` to automatically compute and ensure that the min y-value is at most `[num]`.

`lineColors` - lineColors Array containing colors for the series lines/points.

`pointFillColors` - Colors for the series points. By default uses the same values as `lineColors`.

### Bar Chart

[](#bar-chart)

```
use antishov\Morris;
use yii\web\JsExpression;

echo Morris\Bar::widget([
     'element' => 'barChart',
     'data' => [
         ['date' => '2017-06-14', 'value' => 2.36],
         ['date' => '2017-06-15', 'value' => 0.79],
         ['date' => '2017-06-16', 'value' => 9.99]
     ],
     'xKey' => 'date',
     'yKeys' => ['value'],
     'labels' => ['Revenue'],
     'barColors' => ['rgb(82, 188, 211)', 'rgb(49, 167, 193)'],
 ]);
```

#### Properties

[](#properties-1)

`element` - Identifier that will be assigned to the chart.

`data` - The data to plot. This is an array of objects, containing x and y attributes as described by the xkey and ykeys options.

`xKey` - A string containing the name of the attribute that contains date (X) values (see available formats at [spec](http://morrisjs.github.io/morris.js/lines.html)).

`yKeys` - A list of strings containing names of attributes that contain Y values (one for each series of data to be plotted).

`labels` - A list of strings containing labels for the data series to be plotted (corresponding to the values in the `ykeys` option).

`barColors` - Array containing colors for the series bars.

Examples
--------

[](#examples)

All examples are stored in the `example` subdirectory and based on Yii2 framework with [Docker](https://www.docker.com/). You are free to set up your own host.

See `Dockerfile` and `docker-compose.yml` to get further information.

License
-------

[](#license)

**yii2-morrisjs** is released under the MIT License. See the bundled `LICENSE.md` for details.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~582 days

Total

2

Last Release

2669d ago

PHP version history (2 changes)v1.0PHP &gt;=5.6

v1.1.2PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/839db58d2dfcadeca6eb8db2f12b307e7a1a1ebc3f2a2fb3fbd136562b22b969?d=identicon)[Antishov](/maintainers/Antishov)

---

Top Contributors

[![wiperawa](https://avatars.githubusercontent.com/u/14181470?v=4)](https://github.com/wiperawa "wiperawa (9 commits)")[![antishov](https://avatars.githubusercontent.com/u/19717208?v=4)](https://github.com/antishov "antishov (1 commits)")

---

Tags

axis-labelschartdrawinggraphmorrisphpphp7plotwidgetyii2yii2-morrisjsyii2-widgetsyii2chartmorris

### Embed Badge

![Health badge](/badges/antishov-yii2-morrisjs/health.svg)

```
[![Health](https://phpackages.com/badges/antishov-yii2-morrisjs/health.svg)](https://phpackages.com/packages/antishov-yii2-morrisjs)
```

###  Alternatives

[onmotion/yii2-widget-apexcharts

Yii2 charts widget - wrapper for the ApexCharts.js

1957.6k1](/packages/onmotion-yii2-widget-apexcharts)[asinfotrack/yii2-toolbox

Yii2-Toolbox is a collection of useful helpers, widgets etc. extending the basic functionality of Yii2

1230.5k5](/packages/asinfotrack-yii2-toolbox)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
