Skip to content

Commit

Permalink
fixing bug where setOptions does not process png and material attributes
Browse files Browse the repository at this point in the history
moving contributors from composer to separate file
  • Loading branch information
kevinkhill committed Nov 1, 2017
1 parent dfe57a2 commit c8fe9a2
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 44 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
- 3.1.9
- Fixing bug where using `setOptions` instead of the constructor skipped the processing of `png` and `material` attributes.

- 3.1.8
- Production build of the Lava.js module.

- 3.1.7
- Added the tag lavacharts to the config publishing.
Use `php artisan vendor:publish --tag=lavacharts`
If that does not work, try to clear the cache with `php artisan config:clear` and re-publish with `--force`.

- 3.1.6
- The event callback within lava.js was modified to pass back the chart and the datatable so users can interact with either during an event. This solves issue [#203](https://github.com/kevinkhill/lavacharts/issues/203)

- 3.1.5
- Adding DonutChart alias class back

- 3.1.4
- Chart's should resize properly on page resize.

- 3.1.3
- Adding support for date columns to be null which enables support for Gantt charts to have linked sections.
- Adding JavascriptDate class that mimics the way the Javascript Date object is created. (I wanted to be able to copy and paste google's examples into addRows)

- 3.1.1 & 3.1.2
Expand Down
14 changes: 14 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributors

Thank you for finding bugs, helping me fix them, pull requests, issues and anything else.

- [deringer](https://github.com/deringer)
- [MicahKV]([email protected])
- [rajivseelam](https://github.com/rajivseelam)
- [SendDerek](https://github.com/SendDerek)
- [stevebauman](https://github.com/stevebauman)
- [Stonos](https://github.com/Stonos)
- [tobias-kuendig](https://github.com/tobias-kuendig)
- [twify93](https://github.com/twify93)

If your name is not on this list and needs to be, I'm sorry! Please add it in a pull request and I will merge it in.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Lavacharts 3.1.8
# Lavacharts 3.1.9

[![Total Downloads](https://img.shields.io/packagist/dt/khill/lavacharts.svg?style=plastic)](https://packagist.org/packages/khill/lavacharts)
[![License](https://img.shields.io/packagist/l/khill/lavacharts.svg?style=plastic)](http://opensource.org/licenses/MIT)
Expand Down Expand Up @@ -59,7 +59,11 @@ If you are using Lavacharts with Silex, Lumen or your own Composer project, that
## Laravel
To integrate Lavacharts into Laravel, a ServiceProvider has been included.

### Laravel 5.x
### Laravel ~5.5
Thanks to the fantastic new [Package Auto-Discovery](https://laravel-news.com/package-auto-discovery) feature added in 5.5, you're ready to go, no extra configuration required :)


### Laravel ~5.4
Register Lavacharts in your app by adding these lines to the respective arrays found in `config/app.php`:
```php
<?php
Expand All @@ -84,7 +88,7 @@ To modify the default configuration of Lavacharts, datetime formats for datatabl
Publish the configuration with `php artisan vendor:publish --tag=lavacharts`


### Laravel 4.x
### Laravel ~4
Register Lavacharts in your app by adding these lines to the respective arrays found in `app/config/app.php`:

```php
Expand Down
46 changes: 5 additions & 41 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,6 @@
"name": "Kevin Hill",
"email": "[email protected]",
"role": "Creator"
},
{
"name": "twify93",
"homepage": "https://github.com/twify93",
"role": "Contributor"
},
{
"name": "SendDerek",
"homepage": "https://github.com/SendDerek",
"role": "Contributor"
},
{
"name": " MicahKV",
"email": "[email protected]",
"role": "Contributor"
},
{
"name": "deringer",
"homepage": "https://github.com/deringer",
"role": "Contributor"
},
{
"name": "stevebauman",
"homepage": "https://github.com/stevebauman",
"role": "Contributor"
},
{
"name": "rajivseelam",
"homepage": "https://github.com/rajivseelam",
"role": "Contributor"
},
{
"name": "tobias-kuendig",
"homepage": "https://github.com/tobias-kuendig",
"role": "Contributor"
},
{
"name": "Stonos",
"homepage": "https://github.com/Stonos",
"role": "Contributor"
}
],
"support": {
Expand All @@ -79,7 +39,6 @@
},
"require-dev": {
"phpunit/phpunit": "~4.8",
"mybuilder/phpunit-accelerator": "~1.1",
"mockery/mockery": "~0.9",
"squizlabs/php_codesniffer": "~2.5",
"satooshi/php-coveralls": "~1.0",
Expand All @@ -100,5 +59,10 @@
"lavajs:pull" : "git subtree --prefix=javascript pull lavajs master",
"lavajs:push" : "git subtree --prefix=javascript push lavajs master"
},
"config": {
"platform": {
"php": "5.4"
}
},
"minimum-stability": "stable"
}
27 changes: 27 additions & 0 deletions src/Charts/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,35 @@ public function __construct(Label $chartLabel, DataTable $datatable = null, arra
if (array_key_exists('elementId', $options)) {
$this->elementId = new ElementId($options['elementId']);
}

$this->setExtendedAttributes();
}

/**
* Set extended chart attributes from the assigned options, if present.
*
* @since 3.1.9
*/
protected function setExtendedAttributes()
{
if (method_exists($this, 'setPngOutput') &&
array_key_exists('png', $this->options))
{
$this->setPngOutput($this->options['png']);

unset($this->options['png']);
}

if (method_exists($this, 'setMaterialOutput') &&
array_key_exists('material', $this->options))
{
$this->setMaterialOutput($this->options['material']);

unset($this->options['material']);
}
}


/**
* Returns the chart type.
*
Expand Down
13 changes: 13 additions & 0 deletions src/Support/Customizable.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,44 @@ public function __call($method, $arg)
*
* @param string $option
* @param mixed $value
* @return self
*/
public function setOption($option, $value)
{
$this->options[$option] = $value;

return $this;
}

/**
* Sets the values of the customized class with an array of key value pairs.
*
* @param array $options
* @return self
*/
public function setOptions(array $options)
{
$this->options = $options;

if (method_exists($this, 'setExtendedAttributes')) {
$this->setExtendedAttributes();
}

return $this;
}

/**
* Merge a set of options with the existing options.
*
* @since 3.0.5
* @param array $options
* @return self
*/
public function mergeOptions(array $options)
{
$this->options = array_merge($this->options, $options);

return $this;
}

/**
Expand Down

0 comments on commit c8fe9a2

Please sign in to comment.