Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^2: Excel and Win32::OLE chart problems

by the_hawk_1 (Scribe)
on Oct 30, 2007 at 19:47 UTC ( #648093=note: print w/replies, xml ) Need Help??

in reply to Re: Excel and Win32::OLE chart problems
in thread Excel and Win32::OLE chart problems


That fix the "style" of the graph!

Unfortunately, I still didn't get the XAxis Values.

Did you still get enough time to help me again?

Here's my *new* code

# Create the chart # $chart = $sheet->ChartObjects->Add(1, 175, 457, 300); $chart->Chart->{ChartType} = xl3DColumnClustered; $chart->Chart->ChartWizard({Source =>$sheet->Range("D5:D12")}); $chart->Chart->SeriesCollection(1)->{XValues}=$sheet->Range("D5:D12"); $chart->Chart->SeriesCollection(1)->{HasDataLabels} = 1; $chart->Chart->SeriesCollection(1)->Interior->{ColorIndex} = 36; $chart->Chart->{HasLegend} = $vtfalse; $chart->Chart->{HasDataTable} = $vtfalse; with ($chart->Chart, 'Elevation' => 15, 'Perspective' => 0, 'Rotation' => 20, 'RightAngleAxes' => $vttrue, 'HeightPercent' => 100, 'AutoScaling' => $vttrue); with ($chart->Chart->Axes(xlCategory), 'TickLabelSpacing' => 1, 'TickMarkSpacing' => 1);
Thanks again!

Replies are listed 'Best First'.
Re^3: Excel and Win32::OLE chart problems
by bmann (Priest) on Oct 30, 2007 at 20:08 UTC
    If I understand your question correctly, the values in B5-B12 should be the XAxis labels, right?

    If so, use that range as the source data for the chart, ie

    $chart->Chart->ChartWizard({Source => $sheet->Range("B5:B12,D5:D12")};
    instead of just D5:D12. I believe that the two SeriesCollection lines are the defaults, so they shouldn't be necessary. Keep the ColorIndex line though.

      Sorry to give you such a bad news, but now I've moved backwards: I've lost all the data in the chart! Is it possible to avoid the chartWizard?!?

      Update:It works! we just need a ; instead of a , in the range line.

        I am having a similar problem. I need to add multiple series to one chart and so I don't believe I can use the ChartWizard.

        Currently, I use the following code to add a series:

        This however does not set the XValues, which I try to do with the following code:
        $Range = $Sheet3->Range("C$num2:C$num1");
        $Chart->SeriesCollection($series)->XValues($Range); ;

        This results in the following error:
        Win32::OLE(0.1709) error 0x80020011: "Does not support a collection"
        in METHOD/PROPERTYGET "XValues" at ./ line 149

        Any Ideas? Thank you in advance.
        gr8 acticle guys, $chart->Chart->{ChartType} = xl3DColumnClustered; in this snippet whre can i find the list of all chartypes supported ? thanx

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://648093]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2021-11-28 18:31 GMT
Find Nodes?
    Voting Booth?

    No recent polls found