Skip to content

Commit

Permalink
Merge tag '2.0.5' into 2.0
Browse files Browse the repository at this point in the history
bumped carbon version and aliased 2.1 to dev-master
  • Loading branch information
kevinkhill committed Feb 24, 2015
2 parents ba80a2f + 86fd017 commit ce856d0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -14,7 +14,7 @@
],
"require": {
"php": ">=5.3.0",
"nesbot/carbon": "1.13.*"
"nesbot/carbon": "~1.14"
},
"require-dev": {
"phpunit/phpunit": "4.1.*",
Expand All @@ -32,7 +32,7 @@
"minimum-stability": "stable",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
"dev-master": "2.1.x-dev"
}
}
}
16 changes: 13 additions & 3 deletions src/Khill/Lavacharts/JavascriptFactory.php
Expand Up @@ -73,7 +73,7 @@ class JavascriptFactory
*
* @var string
*/
private $jsAPI = '<script type="text/javascript" src="//google.com/jsapi"></script>';
private $jsAPI = '<script type="text/javascript" src="//www.google.com/jsapi"></script>';

/**
* Google's DataTable Version
Expand Down Expand Up @@ -133,17 +133,27 @@ private function buildChartJs()
{
$out = $this->jsO.PHP_EOL;

/*
* If the object does not exist for a given chart type, initialise it.
* This will prevent overriding keys when multiple charts of the same
* type are being rendered on the same page.
*/
$out .= sprintf(
'if ( typeof lava.charts.%1$s == "undefined" ) { lava.charts.%1$s = {}; }',
$this->chart->type
).PHP_EOL.PHP_EOL;

//Creating new chart js object
$out .= sprintf(
'lava.charts.%s = {"%s":{chart:null,draw:null,data:null,options:null,formats:[]}};',
'lava.charts.%s["%s"] = {chart:null,draw:null,data:null,options:null,formats:[]};',
$this->chart->type,
$this->chart->label
).PHP_EOL.PHP_EOL;

//Checking if output div exists
$out .= sprintf(
'if (!document.getElementById("%s"))' .
'{console.error("[Lavaharts] No matching element was found with ID \"%s\"");}',
'{console.error("[Lavacharts] No matching element was found with ID \"%s\"");}',
$this->elementId,
$this->elementId
).PHP_EOL.PHP_EOL;
Expand Down

0 comments on commit ce856d0

Please sign in to comment.