You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. ChartJs Widget
  2. ==============
  3. [![Latest Version](https://img.shields.io/github/tag/2amigos/yii2-chartjs-widget.svg?style=flat-square&label=release)](https://github.com/2amigos/yii2-chartjs-widget/tags)
  4. [![Software License](https://img.shields.io/badge/license-BSD-brightgreen.svg?style=flat-square)](LICENSE.md)
  5. [![Build Status](https://img.shields.io/travis/2amigos/yii2-chartjs-widget/master.svg?style=flat-square)](https://travis-ci.org/2amigos/yii2-chartjs-widget)
  6. [![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/2amigos/yii2-chartjs-widget.svg?style=flat-square)](https://scrutinizer-ci.com/g/2amigos/yii2-chartjs-widget/code-structure)
  7. [![Quality Score](https://img.shields.io/scrutinizer/g/2amigos/yii2-chartjs-widget.svg?style=flat-square)](https://scrutinizer-ci.com/g/2amigos/yii2-chartjs-widget)
  8. [![Total Downloads](https://img.shields.io/packagist/dt/2amigos/yii2-chartjs-widget.svg?style=flat-square)](https://packagist.org/packages/2amigos/yii2-chartjs-widget)
  9. Renders a [ChartJs plugin](http://www.chartjs.org/docs/) widget
  10. Installation
  11. ------------
  12. The preferred way to install this extension is through [composer](http://getcomposer.org/download/). This requires the
  13. composer-asset-plugin, which is also a dependency for yii2 – so if you have yii2 installed, you are most likely already
  14. set.
  15. Either run
  16. ```
  17. composer require 2amigos/yii2-chartjs-widget:~2.0
  18. ```
  19. or add
  20. ```json
  21. "2amigos/yii2-chartjs-widget" : "~2.0"
  22. ```
  23. to the require section of your application's `composer.json` file.
  24. Usage
  25. -----
  26. The following types are supported:
  27. - Line
  28. - Bar
  29. - Radar
  30. - Polar
  31. - Pie
  32. - Doughnut
  33. The following example is using the `Line` type of chart. Please, check [ChartJs plugin](http://www.chartjs.org/docs/)
  34. documentation for the different types supported by the plugin.
  35. ```
  36. use dosamigos\chartjs\ChartJs;
  37. <?= ChartJs::widget([
  38. 'type' => 'Line',
  39. 'options' => [
  40. 'height' => 400,
  41. 'width' => 400
  42. ],
  43. 'data' => [
  44. 'labels' => ["January", "February", "March", "April", "May", "June", "July"],
  45. 'datasets' => [
  46. [
  47. 'fillColor' => "rgba(220,220,220,0.5)",
  48. 'strokeColor' => "rgba(220,220,220,1)",
  49. 'pointColor' => "rgba(220,220,220,1)",
  50. 'pointStrokeColor' => "#fff",
  51. 'data' => [65, 59, 90, 81, 56, 55, 40]
  52. ],
  53. [
  54. 'fillColor' => "rgba(151,187,205,0.5)",
  55. 'strokeColor' => "rgba(151,187,205,1)",
  56. 'pointColor' => "rgba(151,187,205,1)",
  57. 'pointStrokeColor' => "#fff",
  58. 'data' => [28, 48, 40, 19, 96, 27, 100]
  59. ]
  60. ]
  61. ]
  62. ]);
  63. ?>
  64. ```
  65. Further Information
  66. -------------------
  67. ChartJs has lots of configuration options. For further information, please check the
  68. [ChartJs plugin](http://www.chartjs.org/docs/) website.
  69. Contributing
  70. ------------
  71. Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
  72. Credits
  73. -------
  74. - [Antonio Ramirez](https://github.com/tonydspaniard)
  75. - [All Contributors](../../contributors)
  76. License
  77. -------
  78. The BSD License (BSD). Please see [License File](LICENSE.md) for more information.
  79. > [![2amigOS!](http://www.gravatar.com/avatar/55363394d72945ff7ed312556ec041e0.png)](http://www.2amigos.us)
  80. <i>Web development has never been so fun!</i>
  81. [www.2amigos.us](http://www.2amigos.us)