Results 1 to 11 of 11

Thread: [RESOLVED] MSChart Control is not displaying the line.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2011
    Location
    Nederland, Texas
    Posts
    68

    Resolved [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.

    Please comment.

  2. #2
    Hyperactive Member
    Join Date
    Oct 2016
    Posts
    369

    Re: MSChart Control is not displaying the line.

    I have never used this control before. I added one to my Form and set it to a 2d line graph. Using the posted code I get this:
    Attached Images Attached Images  
    Last edited by I Love VB6; Feb 23rd, 2017 at 09:08 PM.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2011
    Location
    Nederland, Texas
    Posts
    68

    Re: MSChart Control is not displaying the line.

    Quote Originally Posted by I Love VB6 View Post
    I have never used this control before. I added one to my Form and set it to a 2d line graph. Using the posted code I have same problem
    Hi I Love VB6:

    I sincerely thank you for your quick reply.

    Perhaps another programmer will have the answer.

    Best wishes and kindest regards.

    ProgrammerInVB6

  4. #4
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,143

    Re: MSChart Control is not displaying the line.

    Seeing as how you probably 'got' that piece of code from this thread: http://www.vbforums.com/showthread.p...MSChart-in-VB6

    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.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2011
    Location
    Nederland, Texas
    Posts
    68

    Re: MSChart Control is not displaying the line.

    Hi SamOscarBrown:

    You say you used the control a couple of times. Even though you do not like the control,
    did the control work for you?

    I cannot seem to locate post #5 from dilettante. Perhaps I will receive the reply later.

    Best wishes and kindest regards.

  6. #6
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,143

    Re: MSChart Control is not displaying the line.

    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

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2011
    Location
    Nederland, Texas
    Posts
    68

    Thumbs up Re: MSChart Control is not displaying the line.

    Quote Originally Posted by SamOscarBrown View Post
    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.

    Until then, over and out.

    Many thanks!!!!!

  8. #8
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,143

    Re: MSChart Control is not displaying the line.

    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).

    Out

    Sammi

  9. #9
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,143

    Re: MSChart Control is not displaying the line.

    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!

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jun 2011
    Location
    Nederland, Texas
    Posts
    68

    Re: MSChart Control is not displaying the line.

    Quote Originally Posted by SamOscarBrown View Post
    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.

    Until then - - - bye, bye.

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jun 2011
    Location
    Nederland, Texas
    Posts
    68

    Re: MSChart Control is not displaying the line.

    Quote Originally Posted by SamOscarBrown View Post
    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

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width