You are here

function QuantChartChartAPI::color in Quant 7

Add color to the chart

1 call to QuantChartChartAPI::color()
QuantChartChartAPI::build in plugins/QuantChartChartAPI.inc
Implements parent::build().

File

plugins/QuantChartChartAPI.inc, line 190

Class

QuantChartChartAPI
QuantChart plugin class to generate charts using chart.module (Chart API)

Code

function color() {

  // Load the color palette
  $palette = $this
    ->palette(TRUE);

  // If quant is singular, add a random color
  if ($this->quant->dataType == 'single') {
    $this->chart['#data_colors'][] = $palette[rand(0, count($palette))];
  }
  else {
    for ($i = 0; $i < count($palette); $i++) {
      $this->chart['#data_colors'][] = $palette[$i];
    }
  }
}