[RESOLVED] MSChart Control is not displaying the line.
I have entered the code off the Internet as follows:
' "MSChart1".
Dim arrPrices(1 to 10)
Dim i As Integer
For i = 1 to 10
arrPrices(i)= i * 2
Next i
MSChart1.ChartData = arrPrices
MSChart1 is configured to display a 2d line graph.
I run the program. The existing bar graph is cleared from the graph.
However, the data points above do not appear at all.
read post #5 there from dilettante....should solve your problem.
You really shouldn't just go to the web and 'get code'...best to read the documentation that comes with VB6 (MSDN) when working any issue...MSCHART is no different. I use that control in only a couple small programs---don't like it.
Of course the control 'works' --- it's just not my favorite component, that's all.
Did you click on that link to that thread I copied into post #4 here? If not, do so....you will see another thread with the EXACT same problem (as it is the EXACT same sample code). In that thread, dilettante offers solutions and advice. Start with post #5 in there and rad all posts through to the end of that thread. It should give you some hints. And of course, MY 'hint' is to read all about the MSCHART control before you just start using it with someone else's code.
Of course the control 'works' --- it's just not my favorite component, that's all.
Did you click on that link to that thread I copied into post #4 here? If not, do so....you will see another thread with the EXACT same problem (as it is the EXACT same sample code). In that thread, dilettante offers solutions and advice. Start with post #5 in there and rad all posts through to the end of that thread. It should give you some hints. And of course, MY 'hint' is to read all about the MSCHART control before you just start using it with someone else's code.
Sammi
Hi SamOscarBrown:
Thank you for your reply. I located the delittante post 5 in the thread. I missed your point the first time. I was looking in my thread.
I now have my work cutout for me. My only concern is that delittante is using
variant data. I am working with numeric data. Perhaps I should convert numeric data to variant. I will begin VB6 programming in a few days. My daily schedule is
very busy for the next few days. I will return to the forum on or after Wednesday, March 1, 2017.
Roger! (another military term, like "over and out", which by the way is INCORRECT...when you say OVER, that means that you are stopping saying anything, and letting the other party on the radio speak. When you say OUT, that means you are closing the conversation (radio transmissions). So, by saying BOTH 'over and out', it would be incorrect. THERE, ain't ya glad you happened on an OLD military person!!!!??? ~smile~
Anyway, don't thank me, thank dilettante once you figure out 'why' he is using variants (he discussed that briefly in his posts on that other thread).
Oops, I mean, "OVER"....seeing as how YOU started this thread, I cannot finish (end it) with an "OUT"...same with military radio transmission protocol. Again, ~smile~
Over!
Oops, I mean, "OVER"....seeing as how YOU started this thread, I cannot finish (end it) with an "OUT"...same with military radio transmission protocol. Again, ~smile~
Over!
Hi SamOscarBrown:
Thank you for the clarification. I have no military experience. I remember war movies from years ago where fighter pilots would use the term "over and out"
Apparently, Hollywood got to me.
I appreciate your point, I did open this thread.
Therefore, I will say that I will return to the Forum on or after Friday, March 3, 2017. My plans are changing rapidly, therefore I am changing the return date. I intend to do additional programming (experimentation) before returning to the Forum.
Oops, I mean, "OVER"....seeing as how YOU started this thread, I cannot finish (end it) with an "OUT"...same with military radio transmission protocol. Again, ~smile~
Over!
Hi SamOscarBrown:
I solved the graphing problem in few hours this afternoon, Saturday, March 25, 2017. I decided not to wait until Friday, March 3, 2017, to reply to you.
Here is my reply. Please ignore the red lines:
1. I returned to the arrPrices project that did not work.
2. I applied delittante's methodology.
3. Yes, the new project works.
4. Below is my complete project code.
5. Open a form in VB6.
6. Place the MSChart control on that form.
7. Place two command buttons on that form.
My sincerest thanks to you, delittante and the other responders.
Although you people may contact me at anytime, I consider
this project RESOLVED and complete; therefore, I now
say "OUT" as I understand military protocol for communication.
Option Explicit
Dim i As Long
Dim curI As Currency
Dim Prices(1 To 20, 1 To 3) As Variant
Dim arrPrices(1 To 10, 1 To 3) As Variant
Dim e As Long
Private Sub Command1_Click()
For i = 1 To 20
Prices(i, 1) = " " & CStr(i)
curI = CCur(i)
Prices(i, 2) = curI * 2
Prices(i, 3) = curI * 1.5 + Int(curI) / 10
Next i
With MSChart1
.chartType = VtChChartType2dLine
.RandomFill = False
.ChartData = Prices
End With
End Sub
Private Sub Command2_Click()
For e = 1 To 10
arrPrices(e, 1) = " " & CStr(e)
arrPrices(e, 2) = e * 2
arrPrices(e, 3) = e * 4
Next e
With MSChart1
.chartType = VtChChartType2dLine
.RandomFill = False
.ChartData = arrPrices
End With