Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding TrendLine

I am writing an application in C# that will send the
results to an Excel spreadsheet. The Excel spreadsheet
will contain the tabulated results and charts.

For one chart, there are four series. The chart type for
the first series is Excel.XlChartType.xlColumnClustered.
This is the one that I need to add the trendline to. I
have seen some VB code that add the trend line as follows:

Worksheets("sheet1").ChartObjects(1).Chart.SeriesC ollection
(1).Trendlines.Add type:=xlLinear, name:="Linear Trend"

I can't find the same Add function in C#. When I try to
use the following code:

Excel.Series oSeries = (Excel.Series)
oChart.SeriesCollection(1);
oSeries.Trendlines.Add(Excel.XlTrendlineType.xlPol ynomial,
2, null, null, null, null, null, null);

I get the following compile error:

'Excel.Series.Trendlines(object)' denotes a 'method' which
is not valid in the given context

How do I add a trend line in C#?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change axes settings after adding trendline? Ms.P Charts and Charting in Excel 2 February 1st 09 10:21 PM
Need help adding trendline to area chart RBear3 Charts and Charting in Excel 3 January 16th 08 12:40 PM
Newbie query about adding trendline pb1 Charts and Charting in Excel 1 November 16th 06 06:34 AM
Adding Trendline To Just Some of the Bars in Chart Carroll Charts and Charting in Excel 2 February 27th 06 01:25 PM
Where is the "Chart Menu" for adding a trendline to a set of #s? Exceller In America Charts and Charting in Excel 1 August 5th 05 08:49 PM


All times are GMT +1. The time now is 01:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"