Exemplo n.º 1
0
 /**
  * Custom serialization of the ChartWrapper.
  *
  * @return array
  */
 public function jsonSerialize()
 {
     if ($this->wrappedObject instanceof Chart) {
         $type = 'chartType';
     }
     if ($this->wrappedObject instanceof Filter) {
         $type = 'controlType';
     }
     return [$type => $this->wrappedObject->getType(), 'containerId' => (string) $this->containerId, 'options' => $this->wrappedObject];
 }
 /**
  * Builds the javascript object of event callbacks.
  *
  * @access private
  *
  * @return string Javascript code block.
  */
 private function buildEventCallbacks()
 {
     $out = '';
     foreach ($this->chart->getEvents() as $event) {
         $callback = sprintf('function (event) {return lava.event(event, $this.chart, %s);}', $event->callback);
         $out .= sprintf('google.visualization.events.addListener($this.chart, "%s", %s);', $event::TYPE, $callback) . PHP_EOL . PHP_EOL;
     }
     return $out;
 }
Exemplo n.º 3
0
 /**
  * Builds a new PieChart with the given label, datatable and options.
  *
  * @param  \Khill\Lavacharts\Values\Label         $chartLabel Identifying label for the chart.
  * @param  \Khill\Lavacharts\DataTables\DataTable $datatable DataTable used for the chart.
  * @param array                                   $config
  */
 public function __construct(Label $chartLabel, DataTable $datatable, $config = [])
 {
     $options = new Options($this->pieDefaults);
     if (isset($this->donutDefaults)) {
         $options->extend($this->donutDefaults);
         $options->set('pieHole', 0.5);
     }
     parent::__construct($chartLabel, $datatable, $options, $config);
 }
Exemplo n.º 4
0
 /**
  * Builds the javascript for the datatable column formatters.
  *
  * @access private
  * @return string Javascript code block.
  */
 private function buildFormatters()
 {
     $output = '';
     $columns = $this->chart->getDataTable()->getFormattedColumns();
     foreach ($columns as $index => $column) {
         $format = $column->getFormat();
         $output .= sprintf('$this.formats["col%1$s"] = new google.visualization.%2$s(%3$s);' . '$this.formats["col%1$s"].format($this.data, %1$s);', $index, $format->getType(), json_encode($format)) . PHP_EOL;
     }
     return $output;
 }
Exemplo n.º 5
0
 public function __construct($c)
 {
     parent::__construct($c);
     $this->defaults = array_merge($this->defaults, array('axisTitlesPosition', 'barGroupWidth', 'focusTarget', 'hAxis', 'isHtml', 'series', 'seriesType', 'vAxes', 'vAxis'));
 }
Exemplo n.º 6
0
 /**
  * Builds a new GeoChart with the given label, datatable and options.
  *
  * @param \Khill\Lavacharts\Values\Label         $chartLabel Identifying label for the chart.
  * @param \Khill\Lavacharts\DataTables\DataTable $datatable DataTable used for the chart.
  * @param array                                  $config
  */
 public function __construct(Label $chartLabel, DataTable $datatable, $config = [])
 {
     $options = new Options($this->geoDefaults);
     parent::__construct($chartLabel, $datatable, $options, $config);
 }
Exemplo n.º 7
0
 public function __construct($chartLabel)
 {
     parent::__construct($chartLabel);
     $this->defaults = array_merge($this->defaults, array('annotations', 'axisTitlesPosition', 'barGroupWidth', 'dataOpacity', 'enableInteractivity', 'focusTarget', 'forceIFrame', 'hAxes', 'hAxis', 'isStacked', 'reverseCategories', 'orientation', 'series', 'theme', 'trendlines', 'trendlines.n.color', 'trendlines.n.degree', 'trendlines.n.labelInLegend', 'trendlines.n.lineWidth', 'trendlines.n.opacity', 'trendlines.n.pointSize', 'trendlines.n.showR2', 'trendlines.n.type', 'trendlines.n.visibleInLegend', 'vAxis', 'vAxis'));
 }
Exemplo n.º 8
0
 /**
  * Stores a chart in the volcano datastore.
  *
  * @param  \Khill\Lavacharts\Charts\Chart $chart Chart to store in the volcano.
  * @return boolean
  */
 public function storeChart(Chart $chart)
 {
     $this->charts[$chart->getType()][(string) $chart->getLabel()] = $chart;
     return true;
 }
Exemplo n.º 9
0
 public function __construct(Chart $chart, $code = 0)
 {
     $message = $chart::TYPE . '(' . $chart->getLabel() . ') has no DataTable.';
     parent::__construct($message, $code);
 }
Exemplo n.º 10
0
 public function __construct($chartLabel)
 {
     parent::__construct($chartLabel);
     $this->defaults = array_merge($this->defaults, array('axisTitlesPosition', 'barGroupWidth', 'focusTarget', 'hAxis', 'isHtml', 'isStacked', 'vAxis'));
 }
Exemplo n.º 11
0
 /**
  * Builds a new chart with the given label.
  *
  * @param  \Khill\Lavacharts\Values\Label         $chartLabel Identifying label for the chart.
  * @param  \Khill\Lavacharts\DataTables\DataTable $datatable  DataTable used for the chart.
  * @param array                                   $config
  * @throws \Khill\Lavacharts\Exceptions\InvalidOption
  * @internal param array $options Array of options to set for the chart.
  */
 public function __construct(Label $chartLabel, DataTable $datatable, $config = [])
 {
     $calendarOptions = new Options($this->calendarDefaults);
     $options = new Options($this->extChartDefaults);
     $options->merge($calendarOptions);
     $options->set('calendar', $calendarOptions);
     parent::__construct($chartLabel, $datatable, $options, $config);
 }
Exemplo n.º 12
0
 public function __construct($chartLabel)
 {
     parent::__construct($chartLabel);
     $this->defaults = array_merge($this->defaults, array('is3D', 'slices', 'pieSliceBorderColor', 'pieSliceText', 'pieSliceTextStyle', 'pieStartAngle', 'reverseCategories', 'sliceVisibilityThreshold', 'pieResidueSliceColor', 'pieResidueSliceLabel'));
 }
Exemplo n.º 13
0
 public function __construct($chartLabel)
 {
     parent::__construct($chartLabel);
     $this->options = array('calendar' => array());
     $this->defaults = array_merge($this->defaults, array('cellColor', 'cellSize', 'dayOfWeekLabel', 'dayOfWeekRightSpace', 'daysOfWeek', 'focusedCellColor', 'monthLabel', 'monthOutlineColor', 'underMonthSpace', 'underYearSpace', 'unusedMonthOutlineColor', 'colorAxis', 'forceIFrame', 'noDataPattern'));
 }
Exemplo n.º 14
0
 public function __construct($chartLabel)
 {
     parent::__construct($chartLabel);
     $this->defaults = array('datatable', 'height', 'width', 'forceIFrame', 'greenColor', 'greenFrom', 'greenTo', 'majorTicks', 'max', 'min', 'minorTicks', 'redColor', 'redFrom', 'redTo', 'yellowColor', 'yellowFrom', 'yellowTo');
 }
Exemplo n.º 15
0
 public function __construct($chartLabel)
 {
     parent::__construct($chartLabel);
     $this->defaults = array_merge($this->defaults, array('colorAxis', 'datalessRegionColor', 'displayMode', 'enableRegionInteractivity', 'keepAspectRatio', 'region', 'magnifyingGlass', 'markerOpacity', 'resolution', 'sizeAxis'));
 }
Exemplo n.º 16
0
 public function __construct($chartLabel)
 {
     parent::__construct($chartLabel);
     $this->defaults = array_merge($this->defaults, array('annotations', 'axisTitlesPosition', 'barGroupWidth', 'dataOpacity', 'enableInteractivity', 'focusTarget', 'forceIFrame', 'hAxes', 'hAxis', 'isStacked', 'reverseCategories', 'orientation', 'series', 'theme', 'vAxes', 'vAxis'));
 }
Exemplo n.º 17
0
 public function __construct($chartLabel)
 {
     parent::__construct($chartLabel);
     $this->defaults = array_merge($this->defaults, array('areaOpacity', 'axisTitlesPosition', 'focusTarget', 'hAxis', 'isHtml', 'interpolateNulls', 'lineWidth', 'pointSize', 'vAxis'));
 }
Exemplo n.º 18
0
 public function __construct($chartLabel)
 {
     parent::__construct($chartLabel);
     $this->defaults = array('headerColor', 'headerHeight', 'headerHighlightColor', 'maxColor', 'maxDepth', 'maxHighlightColor', 'maxPostDepth', 'maxColorValue', 'midColor', 'midHighlightColor', 'minColor', 'minHighlightColor', 'minColorValue', 'noColor', 'noHighlightColor', 'showScale', 'showTooltips', 'fontColor', 'fontFamily', 'fontSize');
 }