Skip to content

Commit

Permalink
Updated default behavior for query function to change the seriesText …
Browse files Browse the repository at this point in the history
…values.
  • Loading branch information
jbogartPint committed Jun 24, 2016
1 parent 78e007c commit ffbea01
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ There are three levels of usability for this wrapper:
**[setChartType](#setChartType)** - Sets the chart type. ie) Area, Bar, Line, Pie, etc..<br>
**[setChartWidth](#setChartWidth)** - Sets the chart width. ***Note:*** *Defaults to 100%.*<br>
**[setChartHeight](#setChartHeight)** - Sets the chart height. ***Note:*** *Defaults to 400px.*<br>
**[setChartTheme](#setChartTheme)** - Sets the chart color theme. ie) light, dark, classic<br>
**[setChartTheme](#setChartTheme)** - Sets the chart color theme. ie) light, dark, classic.<br>
**[setFullscreen](#setFullscreen)** - Sets the chart's width and height to fit the window.<br>

**[enableScaleXZooming](#enableScaleXZooming)** - Turn on chart zooming on x-axis.<br>
**[enableScaleYZooming](#enableScaleYZooming)** - Turn on chart zooming on y-axis.<br>
Expand Down Expand Up @@ -386,6 +387,18 @@ $zc->setChartTheme("dark");
```

---
<a id="setFullscreen"></a>
### setFullscreen ( ) `Level 1`
Toggles the chart to fit the window. Calling this method twice will disable fullscreen.

**Example:**

```php
$zc->setFullscreen();
```

---

<a id="enableScaleXZooming"></a>
### enableScaleXZooming ( ) `Level 1`
Turn on chart zooming on x-axis.
Expand Down
20 changes: 12 additions & 8 deletions src/zc.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ public function setScaleYTitle($title) {
public function setScaleXLabels($labelsArray) {
$this->setConfig('scale-x.labels', $labelsArray);
}
public function setScaleYLabels($yAxisRange) { // "0:100:5"
public function setScaleYLabels($yAxisRange) { // "0:100:5"
$this->setConfig('scale-y.values', $yAxisRange);
}
public function setSeriesData() {
}
public function setSeriesData() {
$numArgs = func_num_args();
if ($numArgs == 1) {
for ($j = 0; $j < count(func_get_arg(0)); $j++) {
Expand All @@ -202,7 +202,7 @@ public function setSeriesText() {
$numArgs = func_num_args();
if ($numArgs == 1) {
for($i = 0; $i < count(func_get_arg(0)); $i++) {
$this->setConfig('series['.$j.'].text', func_get_arg(0)[$i]);
$this->setConfig('series['.$i.'].text', func_get_arg(0)[$i]);
//$this->config['series'][$i]['text'] = func_get_arg(0)[$i];
}
}
Expand Down Expand Up @@ -234,8 +234,8 @@ public function setFullscreen() {

public function enableScaleXZooming() {
$this->setConfig('scale-x.zooming', true);
}
public function enableScaleYZooming() {
}
public function enableScaleYZooming() {
$this->setConfig('scale-y.zooming', true);
}
public function enableCrosshairX() {
Expand Down Expand Up @@ -338,8 +338,6 @@ public function setConfig($keyChain, $val) {
$indexStart = strpos($chain[0], "[");
$indexEnd = strpos($chain[0], "]");

echo 'chain: '. json_encode($chain) . "<br>";

if ($indexStart > -1) {
$index = (substr($chain[0], $indexStart+1, ($indexEnd-$indexStart)+1))*1;
$parentKey = substr($chain[0], 0, $indexStart);
Expand All @@ -365,9 +363,15 @@ private function autoAxisTitles($scaleXFlag=false, $xLabels=array()) {
$this->setConfig('scale-x.label.text', $this->xAxisTitle);
$this->setConfig('scale-y.label.text', $this->fieldNames[0]);
$this->setConfig('scale-x.labels', $xLabels);
for ($i = 0; $i < count($this->fieldNames); $i++) {
$this->setConfig('series['.$i.'].text', $this->fieldNames[$i]);
}
}
else {
$this->setConfig('scale-y.label.text', $this->fieldNames[0]);
for ($j = 0; $j < count($this->fieldNames); $j++) {
$this->setConfig('series['.$j.'].text', $this->fieldNames[$j]);
}
}
}

Expand Down

0 comments on commit ffbea01

Please sign in to comment.