Re: newbee...ploting a graph
so u want to create a graph in excel using the data in your text file?
PS welcome to the forums...
let me try some code myself first.... :D
Re: newbee...ploting a graph
Welcome to the forums
This is to add the chart to your own program, not excel.
To put a graph similar to Excels (actually exactly like excel's) you'll need the microsoft chart control. To load it goto components (in the project menu) and scroll down to it and select it. You then use columncount and rowcount to set how many columns and rows you need, then move through them useing column and row properties and add your values in the data property.
Re: newbee...ploting a graph
thanks guy
i got that ms chart thing up but i'm not sure if its what i'm looking for
i need an x y scatter chart
all my programme is is basically a loop
it loops x values from say -3 to +3
then it returns a y vaule for a particular x
then it loops back and but in a new value for x
then out comes a new value for y
as it goes through each loop it writes the x and y values to a txt file
which i can then import to excel and plot the graph
what i need is not to use excel at all..
please.. speak to me like i;m retarded!!!
Re: newbee...ploting a graph
ohh
just found an x y scatter chart
how to i tell it my x and y values???? i think thats my problem
Re: newbee...ploting a graph
Re: newbee...ploting a graph
The easiest way to plat data is to put it into a 2-d array where
arrData(i,1) = Xi
arrData(i,2) = Yi
then use the ChartData Property of the MSChart control.
VB Code:
MSChart1.ChartData = arrPrices
For your purposes set the Chart type to VtChChartType2dXY
Here is an example
VB Code:
Dim arrPrices()
Dim i As Integer
Dim maxval As Integer
MSChart1.chartType = VtChChartType2dXY
maxval = 100
ReDim arrPrices(1 To maxval, 1 To 2)
For i = 1 To maxval
'X-value
arrPrices(i, 1) = Sin(i / 5) * 50
'y-Value
arrPrices(i, 2) = Sin(i / 10) * 50
Next i
MSChart1.ChartData = arrPrices
If you set ChartType to VtChChartType2dLine, then you don't need X-values. A 1-d array in this case will plot Y-values vs. x=1,2,3,4,... A 2-d Array will plot two data sets.
Re: newbee...ploting a graph
hey moeur
thanks a mil
havnt got it to work for my particular app yet but at least i can get the graph to plot from your code so i have a solid starting point all i need to do now is adapt, i never knew about "arrays" before (as my name suggests i am a fish!) but i figure once i brush up on them i should get some kind of result.
if i succeed i'll post again (give me a few days!!!!)
james
Re: newbee...ploting a graph
woo hoo woo hoo
i got it to work
thanks a million you guys!!!
now i can concentrate on thermodynamics (exams post christmas)
just one thing if anyone could help me
when i start the app the graph is there but theres already 4 crazy plots on it
when i run the app they dissappear and my plot comes up
how can i get the graph to be blank as soon as i open the project???
dont worry if you dont know, its functional now anyways!!!
thanks again
james
Re: newbee...ploting a graph
Quote:
how can i get the graph to be blank as soon as i open the project???
dont worry if you dont know, its functional now anyways!!!
try setting the chart value = nothing or "" on formload....
Re: newbee...ploting a graph
Go to properties of the graph, and delete the values that draw the default chart.