Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to save datas in QChart into a txt file?
QtWS25 Last Chance

How to save datas in QChart into a txt file?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 642 Views
  • 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.
  • F Offline
    F Offline
    firsnur96
    wrote on last edited by
    #1

    I have a chart and in my drone are many values comes to the graph.
    I want to save them.
    How can i do such a thing?

    jsulmJ 1 Reply Last reply
    0
    • F firsnur96

      I have a chart and in my drone are many values comes to the graph.
      I want to save them.
      How can i do such a thing?

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @firsnur96 said in How to save datas in QChart into a txt file?:

      How can i do such a thing?

      Using https://doc.qt.io/qt-5/qfile.html
      You can also use https://doc.qt.io/qt-5/qdatastream.html if you want to store in binary format.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      F 1 Reply Last reply
      2
      • jsulmJ jsulm

        @firsnur96 said in How to save datas in QChart into a txt file?:

        How can i do such a thing?

        Using https://doc.qt.io/qt-5/qfile.html
        You can also use https://doc.qt.io/qt-5/qdatastream.html if you want to store in binary format.

        F Offline
        F Offline
        firsnur96
        wrote on last edited by
        #3

        @jsulm

        ```
        QFile file("Sakla/Info." + QTime::currentTime().toString("hh.mm.ss.'txt'"));
        
        if(file.open(QIODevice::WriteOnly | QIODevice::Text))
        {
        
                for (int i=0; i<160; i++ )
                {
                    QTextStream out(&file);
                    out << pars.t[i].f;
        
                }
         }
         file.close();
        
        
        
        Is it true?
        jsulmJ 1 Reply Last reply
        0
        • F firsnur96

          @jsulm

          ```
          QFile file("Sakla/Info." + QTime::currentTime().toString("hh.mm.ss.'txt'"));
          
          if(file.open(QIODevice::WriteOnly | QIODevice::Text))
          {
          
                  for (int i=0; i<160; i++ )
                  {
                      QTextStream out(&file);
                      out << pars.t[i].f;
          
                  }
           }
           file.close();
          
          
          
          Is it true?
          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @firsnur96 said in How to save datas in QChart into a txt file?:

          Is it true?

          Did you test?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          F 1 Reply Last reply
          1
          • jsulmJ jsulm

            @firsnur96 said in How to save datas in QChart into a txt file?:

            Is it true?

            Did you test?

            F Offline
            F Offline
            firsnur96
            wrote on last edited by
            #5

            @jsulm actually i try, it write some datas on the file but i dont know they are true or not.

            I have this function

            void Main:Avi_veri_isle()
            {
                q_x++;
                grafige_deger_ekle(147, pars.t[TM_AV_1_vol_rpm].f);
                grafige_deger_ekle(116, pars.t[TM_AV_1_vtol_bat_vol].f);
                grafige_deger_ekle(117, pars.t[TM_AV_2_vol_rpm].f);
                grafige_deger_ekle(118, pars.t[TM_AV_2_vtol_bat_vol].f);
            
            }
            

            in grafige_deger_ekle function, i will append the numbers on the series
            here is it

            void Main:grafige_deger_ekle(int i, double number)
            {
                   seri[i]->append(q_x, number);
            }
            

            I want to write these numbers into the file.

            jsulmJ 1 Reply Last reply
            0
            • F firsnur96

              @jsulm actually i try, it write some datas on the file but i dont know they are true or not.

              I have this function

              void Main:Avi_veri_isle()
              {
                  q_x++;
                  grafige_deger_ekle(147, pars.t[TM_AV_1_vol_rpm].f);
                  grafige_deger_ekle(116, pars.t[TM_AV_1_vtol_bat_vol].f);
                  grafige_deger_ekle(117, pars.t[TM_AV_2_vol_rpm].f);
                  grafige_deger_ekle(118, pars.t[TM_AV_2_vtol_bat_vol].f);
              
              }
              

              in grafige_deger_ekle function, i will append the numbers on the series
              here is it

              void Main:grafige_deger_ekle(int i, double number)
              {
                     seri[i]->append(q_x, number);
              }
              

              I want to write these numbers into the file.

              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @firsnur96 said in How to save datas in QChart into a txt file?:

              but i dont know they are true or not

              How should I know? It is your data.
              You should define a format you want to use to store these numbers in a file. For example one number per line in text file, or coma separated list or whatever you like.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              F 1 Reply Last reply
              0
              • jsulmJ jsulm

                @firsnur96 said in How to save datas in QChart into a txt file?:

                but i dont know they are true or not

                How should I know? It is your data.
                You should define a format you want to use to store these numbers in a file. For example one number per line in text file, or coma separated list or whatever you like.

                F Offline
                F Offline
                firsnur96
                wrote on last edited by
                #7

                @jsulm said in How to save datas in QChart into a txt file?:

                How should I know? It is your data.

                you are right.
                I want to ask another thing, i was confused about where should i do the write operation.
                Where should be placed my write function

                jsulmJ 1 Reply Last reply
                0
                • F firsnur96

                  @jsulm said in How to save datas in QChart into a txt file?:

                  How should I know? It is your data.

                  you are right.
                  I want to ask another thing, i was confused about where should i do the write operation.
                  Where should be placed my write function

                  jsulmJ Online
                  jsulmJ Online
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @firsnur96 said in How to save datas in QChart into a txt file?:

                  Where should be placed my write function

                  I don't know. Depends when you want to store the data in a file.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved