Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.charting
|
|||
|
|||
Create a new chart in C#
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(Typ e.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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I create a link between columns from a data chart? | Excel Discussion (Misc queries) | |||
How to create a chart based on a 2 dim data range dynamical in 1 d | Charts and Charting in Excel | |||
Macro to Create a Chart and Update it Automatically | Charts and Charting in Excel | |||
How to create combination stacked area and line chart? | Charts and Charting in Excel | |||
Urgent Chart Assistance Requested | Excel Discussion (Misc queries) |