Solved

xy scatter plot in MSchart

Posted on 1998-06-25
2,526 Views
I'm trying to produce a simple y vs x plot a la Excel with MSChart. The x and y data  are in the same array and all I want to do is plot y vs. x with a linear scale on both axes. THis should be easy but I can't get it to work.
0
Question by:lberan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 4

Accepted Solution

Nazmi earned 50 total points
ID: 1464270
Dear Iberan,
It is very easy to plot x vs y. I recommend you define your chart on run time.
First of all choose MS Chart Common Controls object and define it on a form (MSChart1).
Afterwards try to locate your x and y values in a data file such as Data.dat
Now, you can write a code to open data file and read x and y values.

Dim rowCount As Integer
Dim columnCount As Integer
Dim DataGrid As DataGrid

MSChart1.chartType = VtChChartType2dX
MSChart1.SeriesType = VtChSeriesType2dXY

Open "c:\Data.dat" For Input As #1
With MSChart1.DataGrid
rowCount = 4
columnCount = 5
.SetSize RowLabelCount, ColumnLabelCount, _
rowCount, columnCount

For i = 1 To rowCount
Input #1, X, Y
.SetData i, 1, X, 0
.SetData i, 2, C1, 0

Next i
End With
Close #1

With MSChart1.Plot

.UniformAxis = True
.LocationRect.Max.Y = 5500
.LocationRect.Min.Y = 0
.LocationRect.Max.X = 10000
.LocationRect.Min.X = 800
.Axis(VtChAxisIdY).AxisTitle.Visible = True
.Axis(VtChAxisIdX).AxisTitle.Text = "I am X-Axis"
.Axis(VtChAxisIdY).AxisTitle.Text = "I am Y-Axis"

0

Expert Comment

ID: 1464271
If you have any trouble mail me please:
nazmi@arcelik.com.tr
0

Expert Comment

ID: 1464272
Dim Y As Double
Dim X As Double
0

Expert Comment

ID: 1464273
Dear Iberan,
Why haven't you evaluate, I mean give a point, my answer?
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month6 days, 22 hours left to enroll