Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Using two charts in a single graph

by zxc420 (Initiate)
on Jul 17, 2013 at 09:23 UTC ( #1044775=perlquestion: print w/replies, xml ) Need Help??
zxc420 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Monks,

I was hoping someone might have a solution to creating a column chart in excel along with a line chart.

I've done a quite a bit of searching, I'm hoping this is not a redundant question.

Below i have a piece of code which after writing the excel values creates a graph from the relative positions. $summary_counter_column contains the final column value that was written for the graph source data. $summary_counter_row contains the final row value used.

I know that each third cycle through the data will be the comparative result of the previous two columns (column 1 - column 2 = difference). I was hoping to plot this is as a line chart over the column chart. So the columns are the values used for comparison, the line is the difference between them.

Either way, the below might be useful to someone else even in it's current state.

$row_counter=0; $column_counter=0; my $chart = $workbook->add_chart( type => 'column',embedded => 1 ); $alphabetic_increment='A'; for ( $column_counter=1; $column_counter < $summary_counter_column; $c +olumn_counter++ ) { $alphabetic_increment++; $chart->add_series ( name => '=SUMMARY!$'."$alphabetic_increment".'$1', categories =>'=SUMMARY!$A$2:$A'."$summary_counter_row", values =>'=SUMMARY!$'."$alphabetic_increment".'$2:$'."$alphab +etic_increment".'$'."$summary_counter_row" ); } $chart->set_title ( name => 'Summary' ); $chart->set_x_axis( name => 'Item List' ); $chart->set_y_axis( name => 'Amount' ); $summary->insert_chart( 'D16', $chart, 100, 50 );

Replies are listed 'Best First'.
Re: Using two charts in a single graph
by Anonymous Monk on Aug 14, 2013 at 06:36 UTC
    I am facing same problem, need to have different chart types in one chart. Please provide some solution to it

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1044775]
Approved by Corion
Front-paged by ww
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2017-07-22 13:27 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (339 votes). Check out past polls.