Configuring the Y-Axis of the chart

Some charts with a Y Axis can be configured. The aspects of the Y Axis that can be currently customized are:

  1. The name of the Y-Axis
  2. The number formatting of the Y AXis.

To do this, you will need to use the setYAxis function.

    $chart->setYAxis("Sales", array(
      "numberPrefix" => "$"
  1. The first parameter is the name of the Y Axis
  2. The second optional parameter is an object containing Standard number formatting properties.

Complete example


class SampleDashboard extends StandaloneDashboard { public function buildDashboard(){ $chart = new ChartComponent("my_first_chart"); $chart->setCaption("Expenses incurred for Food Consumption by Month"); $chart->setYAxis("Sales", array( "numberPrefix" => "$" )); $chart->setDimensions (4, 4); $chart->setLabels (["Jan", "Feb", "Mar"]); $chart->addSeries ("beverages", "Beverages", [1355, 1916, 1150]); $chart->addSeries ("packaged_foods", "Packaged Foods", [1513, 976, 1321]);

$this->addComponent ($chart);

} }

$db = new SampleDashboard(); $db->renderStandalone();