Hi
I need to add a chart with a number of xlXYScatter series to a sheet.
I have been able to add the chart with a serie but I cannot find out how to
add the X and Y range the Schatter serie needs.
The range is in 2 columns that are not next to each other.
I have my code below. The serie needs to take the data from RangeX and
RangeY:
However how do I tell the serie where the X Values and the Y Values are in
the sheet?
MSExcel.Range RangeX = Sheet.get_Range(Sheet.Cells[42, 3], Sheet.Cells[100,
3]);
MSExcel.Range RangeY = Sheet.get_Range(Sheet.Cells[42, 5], Sheet.Cells[100,
5]);
MSExcel.ChartObjects ChartObjects =
(MSExcel.ChartObjects)Sheet.ChartObjects(missing);
MSExcel.ChartObject Chart = ChartObjects.Add(1, 20, 250, 250);
Chart.Chart.ChartWizard(RangeX, MSExcel.XlChartType.xlXYScatter, missing,
missing, missing, missing, missing, "Title", missing, missing, issing);
Chart.Activate();
Thanks Torben
Cindy M. - 29 Jan 2007 15:52 GMT
Hi Torben,
> need to add a chart with a number of xlXYScatter series to a sheet.
>
> I have been able to add the chart with a serie but I cannot find out how to
> add the X and Y range the Schatter serie needs.
This question really deals more with the Excel object model than with VSTO.
Since you haven't gotten a response here, try asking in the excel.programming
newsgroup, where you'll find the specialists.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)