Documentation Home
Examples
Pie Charts
Overview
Customizing the chart
Function Reference
Examples
Line & Bar Graphs
Overview
Adding data
Customizing the bars
Customizing the axes
Function Reference
Support
Installation
Version History
Technical Support
Previous: bar_example2.example.phpNext: bar_axis_position2.example.php

Example Chart: bar_axis_negative2.example.php

<?php
  include( 'chartlogix.inc.php' );
 
  $chart = new BarChart();
  $chart->setLegendWidth( 30 );
 
  $chart->setXAxisTitleStyle( 'arial.ttf', 10, 'CC0000' );
  $chart->setYAxisTitleStyle( 'arial.ttf', 20, '009900' );
 
  $chart->setLeftAxisTitle( 'MP3 Player Sales' );
  $chart->setBottomAxisTitle( 'Months in 2008' );
 
  $chart->setStackedBarOverlap( 50 );
 
  $chart->doBarSeries( 'Birmingham', 'FFCC00', 'EEAA00' );
  $chart->addData( 'Jan', -61 );
  $chart->addData( 'Feb', -22 );
  $chart->addData( 'Mar', 37 );
  $chart->addData( 'Apr', 98 );
  $chart->addData( 'May', 54 );
 
  $chart->doStackedBarSeries( 'London', 'CCDDFF', 'AABBEE' );
  $chart->addData( 'Jan', -10 );
  $chart->addData( 'Feb', 21 );
  $chart->addData( 'Mar', -60 );
  $chart->addData( 'Apr', 10 );
  $chart->addData( 'May', -5 );
 
  $chart->doBarSeries( 'Manchester', 'CC99FF', 'AA77EE' );
  $chart->addData( 'Jan', 32 );
  $chart->addData( 'Feb', -22 );
  $chart->addData( 'Mar', 31 );
  $chart->addData( 'Apr', -29 );
  $chart->addData( 'May', 39 );
 
  $chart->doStackedBarSeries( 'Cambridge', 'CCCCCC', 'AAAAAA' );
  $chart->addData( 'Jan', 34 );
  $chart->addData( 'Feb', 29 );
  $chart->addData( 'Mar', 12 );
  $chart->addData( 'Apr', 3 );
  $chart->addData( 'May', -8 );
 
  $chart->doLineSeries( 'Profit', '66EE66' );
  $chart->setLineStyle( 6, 6 );
  $chart->addData( 'Jan', 100 );
  $chart->addData( 'Feb', -75 );
  $chart->addData( 'Mar', 50 );
  $chart->addData( 'Apr', -25 );
  $chart->addData( 'May', 0 );
 
  $chart->drawPNG( 500, 400 );
Home  |  Online Store  |  Documentation  |  ChartLogix Features  |  Terms & Conditions Copyright © 2024 CubeLogix Ltd