Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8659987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:08:36+00:00 2026-06-12T16:08:36+00:00

The library in question is PHPExcel 1.7.7 I’ve used sample code found in a

  • 0

The library in question is PHPExcel 1.7.7

I’ve used sample code found in a thread at codeplex to create charts with PHPExcel. However, the sample code presented in the forums only deal with two columns of data, and I’m looking to expand the number of columns that are displayed in the chart. The third set of data (column D and beyond) are not being displayed no matter what I try to do with it.

There isn’t a problem with the labels/categories strings – so there’s no collision with any reserved names (even though they’re strings), and I returned the plotValues to see if anything got lost, and I still see that the defined columns are shown in there, but can’t figure out why the third column is not shown in the chart.

$excel->getActiveSheet()->fromArray(array(
    $header ,
    array('Central',   12,   15 , 12 ),
    array('Northeast',   56,   73 , 10 ),
    array('Southeast',   52,   61 , 33 ),
    array('Western',   30,   32 , 55 ),
));


$labels = array(
    new PHPExcel_Chart_DataSeriesValues('String', 'Summary!$B$1', null, 1),
    new PHPExcel_Chart_DataSeriesValues('String', 'Summary!$C$1', null, 1),
    new PHPExcel_Chart_DataSeriesValues('String', 'Summary!$D$1', null, 1),
);

$categories = array(
    new PHPExcel_Chart_DataSeriesValues('String', 'Summary!$A$2:$A$5', null, 4),
);

// this is where the problem arises - the third DataSeriesValues is not being displayed
$values = array(
    new PHPExcel_Chart_DataSeriesValues('Number', 'Summary!$B$2:$B$5', null, 4),
    new PHPExcel_Chart_DataSeriesValues('Number', 'Summary!$C$2:$C$5', null, 4),
    new PHPExcel_Chart_DataSeriesValues('Number', 'Summary!$D$2:$D$5', null, 4),
/*
    new PHPExcel_Chart_DataSeriesValues('Number', 'Summary!$C$2:$C$5', null, 5),
    new PHPExcel_Chart_DataSeriesValues('Number', 'Summary!$D$2:$D$5', null, 5)
    new PHPExcel_Chart_DataSeriesValues('Number', 'Summary!$E$2:$E$5', null, 5),
    new PHPExcel_Chart_DataSeriesValues('Number', 'Summary!$F$2:$F$5', null, 5),
*/
);

$series = new PHPExcel_Chart_DataSeries(
    PHPExcel_Chart_DataSeries::TYPE_BARCHART,       // plotType
    PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED,  //      plotGrouping
    array(0, 1),                                    // plotOrder
    $labels,                                        // plotLabel
    $categories,                                    // plotCategory
    $values                                         // plotValues
);

$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
$plotarea = new PHPExcel_Chart_PlotArea(null, array($series));
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, null, false);


$chart = new PHPExcel_Chart(
    'chart1',                                       // name
    null,                                           // title
    $legend,                                        // legend
    $plotarea,                                      // plotArea
    true,                                           // plotVisibleOnly
    0,                                              // displayBlanksAs
    null,                                           // xAxisLabel
    null                                            // yAxisLabel
);

$chart->setTopLeftPosition('A7');
$chart->setBottomRightPosition('H20');
$excel->getActiveSheet()->addChart($chart);
$excel->getActiveSheet()->setTitle("Summary");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:08:37+00:00Added an answer on June 12, 2026 at 4:08 pm

    As Robbie points out: when you set the plotOrder value in creating your series, you’re only telling the chart to use plots 0 and 1

    array(0, 1),
    

    not plots 0, 1 and 2

    array(0, 1, 2),
    

    I’d be inclined to use

    range(0, count($values)-1),
    

    to ensure that all the data series (no matter how many) are included

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short Question Is there a library that is supposed to replace mswinsoc.osx used to
I found the PHPExcel library brilliant to manipulate Excel files with PHP (read, write,
A question about this R code: library(RODBC) ch <- tryCatch(odbcConnect(RTEST), warning=function(w){print(FAIL! (warning));return(NA)}, error=function(e){print(paste(ERROR:,geterrmessage()));return(NA)}) df
A question for anyone who has used the Java library Mallet's SimpleTagger class for
This question is specific to the opensource GraphView library. (https://github.com/jjoe64/GraphView) Have someone used it
After reading and commenting on this question PHP Library for Keeping your site index
I am working with the Drawing Manager in the Drawing Library and a question
This question is not about 'best' barcode library recommendation, we use various products on
Question What PHP library would you recommend for attaching meeting notices to email? Preference
This question is in regards to Mike Bostock's very exciting d3.js library in general,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.