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_axis_negative3.example.phpNext: pie_hole2.example.php

Example Chart: bar_database1.example.php

<?php
  include( 'chartlogix.inc.php' );
 
  // This is an example of using the addDataToSeries function
   
  $chart = new BarChart();
 
  // Create all the series first
 
  $chart->doBarSeries( 'Sales', '00FF00' );
  $chart->doStackedBarSeries( 'Purchases', 'FF0000' );
  // Now add data to each column
  // addDataToSeries( series name, column name, data value )
  $chart->addDataToSeries( 'Sales', 'Jan', 750 );
  $chart->addDataToSeries( 'Purchases', 'Jan', 270 );
 
  $chart->addDataToSeries( 'Sales', 'Feb', 250 );
  $chart->addDataToSeries( 'Purchases', 'Feb', 630 );
 
  $chart->addDataToSeries( 'Sales', 'Mar', 710 );
  $chart->addDataToSeries( 'Purchases', 'Mar', 510 );
 
  $chart->addDataToSeries( 'Sales', 'Apr', 400 );
  $chart->addDataToSeries( 'Purchases', 'Apr', 230 );
 
  $chart->addDataToSeries( 'Sales', 'May', 690 );
  $chart->addDataToSeries( 'Purchases', 'May', 180 );
 
  // Output the image
   
  $chart->drawPNG( 500, 400 );
Home  |  Online Store  |  Documentation  |  ChartLogix Features  |  Terms & Conditions Copyright © 2024 CubeLogix Ltd