Click here to Skip to main content
15,902,908 members
Home / Discussions / C#
   

C#

 
AnswerRe: style button Pin
OriginalGriff31-May-10 5:12
mveOriginalGriff31-May-10 5:12 
AnswerRe: style button Pin
Abhinav S31-May-10 6:00
Abhinav S31-May-10 6:00 
AnswerRe: style button Pin
Smithers-Jones31-May-10 8:07
Smithers-Jones31-May-10 8:07 
QuestionSpeed Issue in POS Customer Display Pin
NetMan201231-May-10 4:34
NetMan201231-May-10 4:34 
AnswerRe: Speed Issue in POS Customer Display Pin
Luc Pattyn31-May-10 4:51
sitebuilderLuc Pattyn31-May-10 4:51 
AnswerRe: Speed Issue in POS Customer Display Pin
Alan Balkany1-Jun-10 3:50
Alan Balkany1-Jun-10 3:50 
Questionstringbuilder to string Pin
michaelgr131-May-10 1:22
michaelgr131-May-10 1:22 
AnswerRe: stringbuilder to string Pin
Rajeshwar Code- Developer31-May-10 1:31
Rajeshwar Code- Developer31-May-10 1:31 
GeneralRe: stringbuilder to string Pin
michaelgr131-May-10 1:32
michaelgr131-May-10 1:32 
GeneralRe: stringbuilder to string Pin
Not Active31-May-10 2:34
mentorNot Active31-May-10 2:34 
AnswerRe: stringbuilder to string Pin
Not Active31-May-10 2:35
mentorNot Active31-May-10 2:35 
GeneralRe: stringbuilder to string Pin
michaelgr131-May-10 2:46
michaelgr131-May-10 2:46 
AnswerRe: stringbuilder to string Pin
#realJSOP1-Jun-10 4:56
professional#realJSOP1-Jun-10 4:56 
QuestionDataAdaptor.Fill startRecord Pin
Eli Nurman31-May-10 1:18
Eli Nurman31-May-10 1:18 
AnswerRe: DataAdaptor.Fill startRecord Pin
Rajeshwar Code- Developer31-May-10 1:34
Rajeshwar Code- Developer31-May-10 1:34 
QuestionHow to call from an unmanaged DLL to managed code Pin
Keith Vitali31-May-10 0:53
Keith Vitali31-May-10 0:53 
AnswerRe: How to call from an unmanaged DLL to managed code Pin
Abhinav S31-May-10 1:10
Abhinav S31-May-10 1:10 
AnswerRe: How to call from an unmanaged DLL to managed code Pin
Luc Pattyn31-May-10 1:53
sitebuilderLuc Pattyn31-May-10 1:53 
Questionprogrammatically export crystal report with a sub report to .doc file Pin
MayukhSen30-May-10 23:51
MayukhSen30-May-10 23:51 
QuestionHelp ploting Excel graph in C# Pin
Mc_Topaz30-May-10 23:17
Mc_Topaz30-May-10 23:17 
I have the current data in an excel sheet:

<br />
---A---B---C--<br />
1| 0 | 5 | 1 |<br />
2| 2 | 4 | 2 |<br />
3| 4 | 3 | 3 |<br />
4| 6 | 2 | 4 |<br />
5| 8 | 1 | 5 |<br />
<br />


The values for column A and B are the Y-axis values for two lines in the graph. The C column is the X-axis values which both lines shares.

I would like to create a graph containing two lines based on the data above. I don't understand how to do that. The guides on internet are to general and don't deal with this case.

I have come with this method to plot the graph in the active worksheet.
The "workSheet" object is the active work sheet in my C# application.

public void TestAddChart(XlChartType type, System.Drawing.Point location, Size size)
{
      ChartObjects chartObjects = (ChartObjects)workSheet.ChartObjects(Type.Missing);
      ChartObject chartObject = chartObjects.Add(location.X, location.Y, size.Width, size.Height);
      Chart chart = chartObject.Chart;

      Range line1Yvalues = workSheet.get_Range("A1", "A5");
      Range line2Yvalues = workSheet.get_Range("B1", "B5");
      Range commonXvalues = workSheet.get_Range("C1", "C5");

      chart.SetSourceData(line1Yvalues, XlRowCol.xlRows);
      chart.SetSourceData(line2Yvalues, XlRowCol.xlRows);
      chart.SetSourceData(commonXvalues, XlRowCol.xlRows);
}


I call the method with this code:

classInstance.TestAddChart(XlChartType.xlLine, new Point(100, 100), new Size(300, 300));


When I shut down my application and look in the excel file, I find the result of the graph to be something else. There is instead a bar chart containing five series.

What shall I change to make this work?
AnswerRe: Help ploting Excel graph in C# Pin
OriginalGriff30-May-10 23:29
mveOriginalGriff30-May-10 23:29 
GeneralRe: Help ploting Excel graph in C# Pin
Mc_Topaz30-May-10 23:51
Mc_Topaz30-May-10 23:51 
GeneralRe: Help ploting Excel graph in C# Pin
Henry Minute31-May-10 0:37
Henry Minute31-May-10 0:37 
GeneralRe: Help ploting Excel graph in C# Pin
Mc_Topaz31-May-10 1:10
Mc_Topaz31-May-10 1:10 
GeneralRe: Help ploting Excel graph in C# Pin
Henry Minute31-May-10 1:23
Henry Minute31-May-10 1:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.