Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Win32::OLE Excel Chart SeriesCollection. Problem changing from Excel 2000 to 2002

Reply
Thread Tools

Win32::OLE Excel Chart SeriesCollection. Problem changing from Excel 2000 to 2002

 
 
moller@notvalid.se
Guest
Posts: n/a
 
      07-01-2004

Win32::OLE Excel Chart SeriesCollection.
Problem when changing from Excel 2000 to 2002


I have a data sheet with 5 columns of data called $Sheet.
In Excel 2000 each of the columns ends up in a separate series
when creating a chart with the 5 columns in the datarange.

When switching from Excel 2000 to Excel 2002 the chart creation
takes the 5 column range and sets the first 4 columns as the
first series.

Does anyone have any idea how to work around this or why it's happening?
Or pointers to relevant documentation somwhere. Or any other
suggestions



A small snip of the relevant code for context follows.

# My datarange
my $Range = $Sheet->Range('B2:F38');

# Create a new chart
my $num_of_Sheets = $Book->Worksheets->{Count};
my $chart = $Book->Charts->Add({After => $Book->Worksheets($num_of_Sheets)})
|| die Win32::OLE->LastError();

# Name the chart
$chart->{Name} = $Cdays[$dow-1];

$chart->SetSourceData({Source => $Range,
PlotBy => xlColumns
});

# Put Chart on a page of its own
$chart->Location({Where => xlLocationAsNewSheet });

$chart->SeriesCollection(1)->{AxisGroup} = xlPrimary;
$chart->SeriesCollection(1)->{ChartType} = xlColumnStacked;
$chart->SeriesCollection(1)->Fill->TwoColorGradient(1,1);
$chart->SeriesCollection(1)->Fill->ForeColor->{SchemeColor} = 10;
$chart->SeriesCollection(1)->Fill->BackColor->{SchemeColor} = 1;

$chart->SeriesCollection(2)->{AxisGroup} = xlPrimary;
$chart->SeriesCollection(2)->{ChartType} = xlColumnStacked;
$chart->SeriesCollection(2)->Fill->TwoColorGradient(1,1);
$chart->SeriesCollection(2)->Fill->ForeColor->{SchemeColor} = 3;
$chart->SeriesCollection(2)->Fill->BackColor->{SchemeColor} = 1;

# Crashes on the following line with
# Can't use an undefined value as a HASH reference at ..... file name and linenr
$chart->SeriesCollection(3)->{AxisGroup} = xlSecondary;
$chart->SeriesCollection(3)->{ChartType} = xlLineMarkers;
$chart->SeriesCollection(3)->{MarkerBackgroundColorIndex} = 7;
$chart->SeriesCollection(3)->{MarkerForegroundColorIndex} = 7;
$chart->SeriesCollection(3)->{MarkerStyle} = xlTriangle;
$chart->SeriesCollection(3)->Border->{Colorindex} = 7;
$chart->SeriesCollection(3)->Border->{Weight} = xlMedium;

SNIP REST..
 
Reply With Quote
 
 
 
 
moller@notvalid.se
Guest
Posts: n/a
 
      07-05-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) writes:

>
> Win32::OLE Excel Chart SeriesCollection.
> Problem when changing from Excel 2000 to 2002
>
>
> I have a data sheet with 5 columns of data called $Sheet.
> In Excel 2000 each of the columns ends up in a separate series
> when creating a chart with the 5 columns in the datarange.
>
> When switching from Excel 2000 to Excel 2002 the chart creation
> takes the 5 column range and sets the first 4 columns as the
> first series.
>
> Does anyone have any idea how to work around this or why it's happening?
> Or pointers to relevant documentation somwhere. Or any other
> suggestions


I found the problem, locale... or lack of it.

On the first computer the WIN-XP was swedish and MSOffice english [1]
so when perl used dot as a decimal separator it worked fine.
Om the new computer both XP and MSOffice was swedish and it broke
on 23.45 when it expected 23,45.

Example Data:
08:00-08:15 | 148 | 56 | 43.275 | 80
08:15-08:30 | 153 | 18 | 11.999 | 90

Column data should be interped as follows

text | number | number | number | number

but since dot was no longer decimal separator
excel interped it as

text | number | number | text | number

and then decided that the first four
columns should be DataSeries(1). That
gave me this data

text | number
08:15-08:30 153 18 11.999 | 90

I wonder why???

/moller

[1]. Somthing I missed
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A real challenge: Create a Gantt-chart-like chart gnewsgroup ASP .Net 4 02-06-2008 02:27 PM
Pie chart: ASP.net 2.0, SQL Server 2000, Excel 2000 C Did ASP .Net 3 06-20-2006 08:35 AM
ASP can generate a chart (pie chart) ? Tarek ASP General 6 11-19-2004 06:33 PM
Diagnostic programs 2004 - 2002, SolarWinds 2002 Broadband Engineer's Edition, SolarWinds Orion Network Performance Monitor, other ! te2 Computer Support 1 09-02-2004 07:29 PM



Advertisments