Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to draw a dynamic curve

how to draw a dynamic curve

Scheduled Pinned Locked Moved C / C++ / MFC
databasetutorial
17 Posts 6 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N nibabug

    i want to lern to draw a dynamic curve,but do not know how to do; is there any good Activecontrol or methode, my idea is, continuesly get data from a database or by some way else, then draw them on a picture, the curve should be dynamic. thanks a lot

    wuhuaiji

    J Offline
    J Offline
    jhwurmbach
    wrote on last edited by
    #2

    What is your problem? In OnDraw(), you draw the curve (MoveTo(), LineTo()) into the client rect. Whenever you get new data and fell the need to redraw, you Invalidate().


    Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all.
    Douglas Adams, "Dirk Gently's Holistic Detective Agency"

    N 1 Reply Last reply
    0
    • N nibabug

      i want to lern to draw a dynamic curve,but do not know how to do; is there any good Activecontrol or methode, my idea is, continuesly get data from a database or by some way else, then draw them on a picture, the curve should be dynamic. thanks a lot

      wuhuaiji

      C Offline
      C Offline
      chandu004
      wrote on last edited by
      #3

      have you googled to for "Active X Control to draw a curve" there are somany articles and active X controls related to that topic. or if you want to develop one active X control, then i can guide you.

      H N 2 Replies Last reply
      0
      • J jhwurmbach

        What is your problem? In OnDraw(), you draw the curve (MoveTo(), LineTo()) into the client rect. Whenever you get new data and fell the need to redraw, you Invalidate().


        Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all.
        Douglas Adams, "Dirk Gently's Holistic Detective Agency"

        N Offline
        N Offline
        nibabug
        wrote on last edited by
        #4

        hello thanks for your answer my problem is, how to make the curve move smoothly? it move from right to left with time going

        wuhuaiji

        J 1 Reply Last reply
        0
        • N nibabug

          i want to lern to draw a dynamic curve,but do not know how to do; is there any good Activecontrol or methode, my idea is, continuesly get data from a database or by some way else, then draw them on a picture, the curve should be dynamic. thanks a lot

          wuhuaiji

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #5

          See An MFC Curve Control[^] and GDI+ Line/Curve Drawing and Hit Test[^].

          1 Reply Last reply
          0
          • N nibabug

            hello thanks for your answer my problem is, how to make the curve move smoothly? it move from right to left with time going

            wuhuaiji

            J Offline
            J Offline
            jhwurmbach
            wrote on last edited by
            #6

            Do you want algorithms to interpolate and smooth the curve-data? Or do you want to reduce flicker on the screen? Either case, there are articles here on codeproject and on the net. E.G. here[^].


            Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all.
            Douglas Adams, "Dirk Gently's Holistic Detective Agency"

            1 Reply Last reply
            0
            • C chandu004

              have you googled to for "Active X Control to draw a curve" there are somany articles and active X controls related to that topic. or if you want to develop one active X control, then i can guide you.

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #7

              But why he must uses of Activexs control?

              C 1 Reply Last reply
              0
              • C chandu004

                have you googled to for "Active X Control to draw a curve" there are somany articles and active X controls related to that topic. or if you want to develop one active X control, then i can guide you.

                N Offline
                N Offline
                nibabug
                wrote on last edited by
                #8

                thanks i have googled, and now i know how to draw a static curve but i want to draw a dynamic curve, which can move smoothly with time going

                wuhuaiji

                C 1 Reply Last reply
                0
                • H Hamid Taebi

                  But why he must uses of Activexs control?

                  C Offline
                  C Offline
                  chandu004
                  wrote on last edited by
                  #9

                  good question, but as he said, he want to draw it on a picture. so i thought, he would have to develop an AX to fulfil his task. iam not sure, weather any existing control, has a mixture of both image and a graph on it.

                  C 1 Reply Last reply
                  0
                  • N nibabug

                    thanks i have googled, and now i know how to draw a static curve but i want to draw a dynamic curve, which can move smoothly with time going

                    wuhuaiji

                    C Offline
                    C Offline
                    chandu004
                    wrote on last edited by
                    #10

                    what is the difference you are referring to as static and dynamic curves. you mean, you want to see the curve increasing from time to time, at run time? if it is so, put your plotting code in a thread. but i can suggest ful fledgedly, only, if u can provide a sample of code here, how you made it static. gud luck.

                    1 Reply Last reply
                    0
                    • C chandu004

                      good question, but as he said, he want to draw it on a picture. so i thought, he would have to develop an AX to fulfil his task. iam not sure, weather any existing control, has a mixture of both image and a graph on it.

                      C Offline
                      C Offline
                      Cedric Moonen
                      wrote on last edited by
                      #11

                      Why are you so obsessed with ActiveX controls :omg:. Why not simply use a custom control ? Do you know why ActiveX are used ? Do you know that the purpose of ActiveX is to have a control that can be used in different languages. If you just developping a C++ app, why bothering with an ActiveX when you can simply use a custom control.


                      Cédric Moonen Software developer
                      Charting control [v1.2]

                      C 1 Reply Last reply
                      0
                      • N nibabug

                        i want to lern to draw a dynamic curve,but do not know how to do; is there any good Activecontrol or methode, my idea is, continuesly get data from a database or by some way else, then draw them on a picture, the curve should be dynamic. thanks a lot

                        wuhuaiji

                        N Offline
                        N Offline
                        Nishad S
                        wrote on last edited by
                        #12

                        Why you cant draw a curve with existing APIs? What kind of data and curve are you intended to use?

                        - NS -

                        N 1 Reply Last reply
                        0
                        • N nibabug

                          i want to lern to draw a dynamic curve,but do not know how to do; is there any good Activecontrol or methode, my idea is, continuesly get data from a database or by some way else, then draw them on a picture, the curve should be dynamic. thanks a lot

                          wuhuaiji

                          C Offline
                          C Offline
                          Cedric Moonen
                          wrote on last edited by
                          #13

                          You have two options: 1) Use an existing control, there are plenty existing on this website. I also developped one control that can do that (see the link in my sig). I think it is the easiest solution and the one that will save you a lot of troubles. 2) Create your own control. You seem to have some problems with the fact that the line should move. Well, there is no miracle: if you want to do such a thing, you have to make it move yourself (redraw the line completely). I warn you that this is far from being the easiest solution. If you are completely new to this, I suggest you take the first option. But if you have some time and want to learn how it works, then it can be interesting to take that path. But then, start by reading some tutorials about how to create custom controls before starting to create your own.


                          Cédric Moonen Software developer
                          Charting control [v1.2]

                          1 Reply Last reply
                          0
                          • C Cedric Moonen

                            Why are you so obsessed with ActiveX controls :omg:. Why not simply use a custom control ? Do you know why ActiveX are used ? Do you know that the purpose of ActiveX is to have a control that can be used in different languages. If you just developping a C++ app, why bothering with an ActiveX when you can simply use a custom control.


                            Cédric Moonen Software developer
                            Charting control [v1.2]

                            C Offline
                            C Offline
                            chandu004
                            wrote on last edited by
                            #14

                            yes you are right. But i feel comfortable with AX because most of the times I use it in other languages also. Thats why i'm used to that. Thank You.

                            C 1 Reply Last reply
                            0
                            • C chandu004

                              yes you are right. But i feel comfortable with AX because most of the times I use it in other languages also. Thats why i'm used to that. Thank You.

                              C Offline
                              C Offline
                              Cedric Moonen
                              wrote on last edited by
                              #15

                              Well, but for somebody that only wants to use a control in its C++ application, this is a bad advice to tell him to develop its own ActiveX control. Why do you want to make things even more complex to him ? Developping an ActiveX control is more complicated than developping a simple custom control.


                              Cédric Moonen Software developer
                              Charting control [v1.2]

                              C 1 Reply Last reply
                              0
                              • N Nishad S

                                Why you cant draw a curve with existing APIs? What kind of data and curve are you intended to use?

                                - NS -

                                N Offline
                                N Offline
                                nibabug
                                wrote on last edited by
                                #16

                                thanks a lot first, i am a newbie, ;P then, i just want draw a curve, which can move now i have got many friends' help, thanks for all of your answer and i think maybe i have found the solution indeed, the question is a little problem, the big problem is that i am fresh in VC

                                wuhuaiji

                                1 Reply Last reply
                                0
                                • C Cedric Moonen

                                  Well, but for somebody that only wants to use a control in its C++ application, this is a bad advice to tell him to develop its own ActiveX control. Why do you want to make things even more complex to him ? Developping an ActiveX control is more complicated than developping a simple custom control.


                                  Cédric Moonen Software developer
                                  Charting control [v1.2]

                                  C Offline
                                  C Offline
                                  chandu004
                                  wrote on last edited by
                                  #17

                                  yes and thanks, i agree to your point.

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups