473,657 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excel Chart - Scatter Lines

48 New Member
Hi,

Can anyone please help me in figuring out what change needs to be done to the below code in order to show the chart (the chart I want is displayed only when I click the "Switch Row/Column" button on the toolbar, I want it to be displayed automatically without manually clicking the button - please see the attached file). Below is my code:


Expand|Select|Wrap|Line Numbers
  1.  Private Sub DisplayGraph()
  2.         Try
  3.             Dim xlApp As Excel.Application
  4.             Dim xlWorkBook As Excel.Workbook
  5.             Dim xlWorkSheet As Excel.Worksheet
  6.             Dim misValue As Object = System.Reflection.Missing.Value
  7.  
  8.             xlApp = New Excel.ApplicationClass
  9.             xlWorkBook = xlApp.Workbooks.Add(misValue)
  10.             xlWorkSheet = xlWorkBook.Sheets("sheet1")
  11.             xlApp.Visible = True
  12.  
  13.             'Adding Data..
  14.             xlWorkSheet.Cells(1, 1) = 2
  15.             xlWorkSheet.Cells(1, 2) = 1
  16.             xlWorkSheet.Cells(2, 1) = 3
  17.             xlWorkSheet.Cells(2, 2) = 2
  18.             xlWorkSheet.Cells(3, 1) = 2
  19.             xlWorkSheet.Cells(3, 2) = 5
  20.             xlWorkSheet.Cells(4, 1) = 4
  21.             xlWorkSheet.Cells(4, 2) = 7
  22.             xlWorkSheet.Cells(5, 1) = 8
  23.             xlWorkSheet.Cells(5, 2) = 2
  24.             xlWorkSheet.Cells(6, 1) = 5
  25.             xlWorkSheet.Cells(6, 2) = 3
  26.  
  27.             Dim oChart As Excel._Chart
  28.             oChart = xlWorkBook.Charts.Add(Missing.Value, Missing.Value, Missing.Value, Missing.Value)
  29.  
  30.             oChart.ChartWizard(xlWorkSheet.Range("A1", "B6"), Excel.XlChartType.xlXYScatterLines, Missing.Value, _
  31.                                 Excel.XlRowCol.xlRows, _
  32.                                 Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, _
  33.                                 Missing.Value, Missing.Value)
  34.         Catch ex As Exception
  35.             MessageBox.Show(ex.Message)
  36.         End Try
  37.  
  38.     End Sub
  39.  
Any help is highly appreciated.

Regards,
Aads
Attached Images
File Type: jpg Graph.jpg (11.9 KB, 123 views)
Dec 8 '09 #1
0 1271

Sign in to post your reply or Sign up for a free account.

Similar topics

13
35524
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
0
2298
by: mscir | last post by:
Date: Thu, 08 Jul 2004 17:02:27 -0700 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <10ero4l3kp2qa65@corp.supernews.com> Reply-To: mscir@usa.com User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@supernews.com
2
2384
by: cfriedalek | last post by:
I'm driving Excel from python, largely successfully. Now I'm trying to add errorbars to XY scatter plots. Keep getting a com_error. Can't track down the problem. I modified a simple example to duplicate the problem. Thanks to Mathieu Fenniak http://www.stompstompstomp.com/weblog/entries/67/ for the code. The traceback is shown below. You can see that the Excel chart series has a method called ErrorBar. But when I try to use it with any...
5
2373
by: Takeadoe | last post by:
I'm doubtful that the group is unbiased, but I will ask anyhow :o). If one intends to plot lots of data, primarily XY line and scatter plots, and mass produce them (in many cases I will be doing 88 graphs at a time - 1 for each of 88 counties), will Exel be the best bet, or is Access equally capable? I might mention that in time, I will be moving all of my data into Access databases. I'm slowing learning charting and automation in...
10
8147
by: Hendri Adriaens | last post by:
Hi, I'm trying to automate the creation of an excel file via COM. I copied my code below. I read many articles about how to release the COM objects that I create. The code below runs just fine and excel is closed. But there are some commented lines: //xlSeries.XValues = xlWs.get_Range("B2", "B4"); // makes com objects, but which...
5
5720
by: grant | last post by:
I'm trying to use a scatter chart to plot level reading for a pump station level sensor. The sensor takes a reading every 4 seconds, and there are 23,000 reading per chart There appears to be a limit of 4000*4000 data points in MS Chart so I have had a play with the Office 10 activX chart control, but cant get that to plot the data at all. It always try to summaries the data for some reason fathomable only to Bill Gates! Mind you, the...
16
5171
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub Storage_Click() On Error GoTo Err_Storage_Click
9
3240
by: AGP | last post by:
I have a VB6 application that has an OLE container with an embedded Excel chart. Our office updated to Excel 2007 and now although the app works the charts looks like crap. Since the app is fairly large my goal is to keep the devlopement in VB6 but am open to any ideas or suggestions. What i want to do is: 1. Keep my app in VB6 and find a workaround for the crappy looking charts. the charts now look very blocky and the grid lines and...
2
6255
by: DaveD170 | last post by:
Hi everybody, I'm newbie in c# and I'm having trouble in creating an excel chart. I have vector of data that my program calculated. It's in the next format: X Y 0.1 100 0.2 90 0.3 80 etc.
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.