Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Excel::Writer::XLSX - pie chart legend's color

by rajeshsaha123 (Initiate)
on Sep 28, 2012 at 06:29 UTC ( [id://996118]=perlquestion: print w/replies, xml ) Need Help??

rajeshsaha123 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to create one excel file, where chart will be included. Though, I am able to create this, but I could not customise the colors of the individual legends within th pie chart. Can anybody give an idea , please . The highlights of my script is as follows :

use Excel::Writer::XLSX ; ...... ..... my $p = $chart->add_series( categories => '=Sheet1!$A1:$B1', values => '=Sheet1!$A2:$B2', data_labels => { value => 1}, ); $chart->set_style( 18 ); $worksheet->insert_chart ('A4', $chart,0,0) ;
To be precise, there are two categories in '=Sheet1!$A1:$B1' viz. "Pass" & "Fail" & I want them to be green & red respectively in pie chart .

Replies are listed 'Best First'.
Re: Excel::Writer::XLSX - pie chart legend's color
by jmcnamara (Monsignor) on Sep 28, 2012 at 08:48 UTC

    It is possible to define chart colors for most types of Excel::Writer::XLSX charts via the add_series() method.

    However, Pie charts in Excel are a special case since each pie segment is actually a point and there isn't currently any way in Excel::Writer::XLSX to define colors for individual points.

    The set_style() method, which you are using, is currently the only way of changing Pie chart colours.

    --
    John.

Re: Excel::Writer::XLSX - pie chart legend's color
by ckj (Chaplain) on Sep 28, 2012 at 07:50 UTC
Re: Excel::Writer::XLSX - pie chart legend's color
by rajeshsaha123 (Initiate) on Sep 28, 2012 at 11:21 UTC

    @john

    Thanks for the explanation. Do you have any plan to implement this in near future ?

    Rajesh

      Hi, perlmonks has threaded discussions :), no need for this @at stuff, just click the reply link on the post you wish to reply to

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://996118]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-19 04:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found