I would like to create a new chart in c#, with each series coming from
a different range.

I have an array of Excel.Range - ranges...

Here's what I have so far:

Excel.Range range = ranges[0];

Excel.Worksheet ws = (Excel.Worksheet)range.Worksheet;
Excel.ChartObjects charts =
(Excel.ChartObjects)ws.ChartObjects(Type.Missing);
Excel.Chart c =
((Excel.ChartObject)charts.Add((double)range.Left, (double)range.Top,
500, 300)).Chart;

chart = c;

Excel.SeriesCollection sc =
(Excel.SeriesCollection)chart.SeriesCollection(Type.Missing);

foreach (Excel.Range r in ranges)
{
Excel.Series series = sc.NewSeries();
series.Values = r;
}


It works - sort of. The chart is created but is invisible. It is
still possible to interact with it though, as control points for series
elements and the draggable handle for the chart itself is present - it
is just invisible!

If I drag it to a new location then it becomes visible.


Where could I be going wrong?


I've tried sc.Add(r,Excel.XlRows, Type.Missing, Type.Missing,
Type.Missing) but got an oleaut 'type mismatch'.

Any help would be greatly appreciated.