Hiya, just when I thought I had ms chart sussed too, sigh... :-)
I need to be able to plot a line of best fit on my graph, is that possible? could anyone tell me how it's done?
thanks for you time :)
Ang
Printable View
Hiya, just when I thought I had ms chart sussed too, sigh... :-)
I need to be able to plot a line of best fit on my graph, is that possible? could anyone tell me how it's done?
thanks for you time :)
Ang
I don't know how. It sounds like statistical something or other. I'll ask brother who may know. In the mean time, go to this link and see if you can find something under Statistics that helps you.
http://www.hoxie.org/math/title.htm
argh .. mschart ...
i never had much success with that piece of crap ...
you can always do what you asked for with an excel reference if that is an option for you ...
how does that excel way work? that sounds handy
i found a way to get a line of best fit, using least squares blah. Had to look back to my old school stats :-). But anyway, now i am able to get the formula into a string, now the next fun part will be getting that on the graph.
stupid graphs :P
Ang
I use the chart control and don't have problems with it. I just use it to display data though. In other words, the user can change the look and copy it to other applications, but I don't let them change values in the chart itself. It's read-only
You'll have to remove some of my function calls, but I'm leaving them in this code because the names are self-explanatory and it will help you see what I did better.
VB Code:
Public Function GraphQuery() As Long Dim i As Long Dim j As Long Dim RST As Recordset Dim iRecordcount As Long Dim iFieldCount As Long On Error GoTo errHandler Dim sData() As String Set RST = DB.OpenRecordset(BASE_QUERY, dbOpenSnapshot) iRecordcount = CountRecords(RST) iFieldCount = RST.Fields.Count If iFieldCount <= 0 Then Exit Function If iRecordcount - 1 < 0 Then MsgBox "No records to graph.", vbInformation, APP_TITLE Exit Function End If ReDim sData(iFieldCount - 1, iRecordcount - 1) For i = 0 To iFieldCount - 1 For j = 0 To iRecordcount - 1 sData(i, j) = RST.Fields(i).Value RST.MoveNext Next j RST.MoveFirst Next i RecordsetClose RST chtGraph.ChartData = sData Exit Function errHandler: GraphQuery = Err End Function