its urgent !!! xy scatter curve in vb/excel - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# its urgent !!! xy scatter curve in vb/excel

Posts: 68Member
I have a data series

x=(100,200,300,400,500)
y=(15,30,45,60,75)
x1=(110,210,290,350,425)
y1=(12,22,43,45,55)

I like to plot curve in such way that x data should form x-axis and y data should form y-axis and form a curve respectively. this is possible in excel xy scatter curve. My problem is i like to use x1 data on x-axis and y1 data on y axis. and it should form a second curve above or below first curve.

Ganesh

• Posts: 404Member
: I have a data series
:
: x=(100,200,300,400,500)
: y=(15,30,45,60,75)
: x1=(110,210,290,350,425)
: y1=(12,22,43,45,55)
:
: I like to plot curve in such way that x data should form x-axis and y data should form y-axis and form a curve respectively. this is possible in excel xy scatter curve. My problem is i like to use x1 data on x-axis and y1 data on y axis. and it should form a second curve above or below first curve.
:
:
:
:
:
: Ganesh
:

Hi, use MSChar control for this..
Here is part of sample code I wrote recently, I would help you to understand how to work with it.. (This project loads data to MSFlexGrid and translate them to the MSChart).. There is just one set of data, but it's not problem to use more of them..
[code]Dim Col As Integer, Row As Integer
Randomize Timer 'to get random numbers
'Get new data
With MSFlexGrid1
For Col = 0 To 1
For Row = 1 To .Rows - 1
.Col = Col
.Row = Row
If Col = 0 Then 'To get X values increasing
.Text = Row * 5
Else
.Text = (Rnd * 1000) Mod 128 - 20 'Random number from -20 to 107
End If
Next Row
Next Col
End With

'Refresh Graph
With MSChart1
.ColumnCount = MSFlexGrid1.Cols
.RowCount = MSFlexGrid1.Rows - 1
For Col = 1 To 2
For Row = 1 To .RowCount
.Column = Col
.Row = Row
.Data = MSFlexGrid1.TextMatrix(Row, Col - 1)
Next Row
If Col > 0 Then
.SeriesType = VtChSeriesType2dXY
.SeriesColumn = 1
End If
Next Col
End With

End Sub

'Settings
With MSFlexGrid1
.FixedCols = 0
.FixedRows = 1
.Cols = 2 'Count of columns
.Rows = 10 'Count of rows with data
.Row = 0
.Col = 0
.Text = "X values"
.Col = 1
.Text = "Y values"
End With

With MSChart1
.Title = "Title of Graph"
.chartType = VtChChartType2dXY
.ShowLegend = True
.Legend.Location.LocationType = VtChLocationTypeRight
.Legend.TextLayout.Orientation = VtOrientationHorizontal
With .Plot.Axis(VtChAxisIdX)
.AxisTitle = "X values"
.ValueScale.Auto = True
.AxisScale.Type = VtChScaleTypeLinear
End With
With .Plot.Axis(VtChAxisIdY)
.AxisTitle = "Y values"
With .ValueScale
.Auto = False
.MajorDivision = 20
.MinorDivision = 1
.Maximum = 110
.Minimum = -20
End With
.AxisScale.Type = VtChScaleTypeLinear
End With
End With
End Sub[/code]

[blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]

[purple]Don't take life too seriously anyway you won't escape alive from it![/purple]