Announcement

Collapse
No announcement yet.

Values from text file prepend with data

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Yeah ive since changed the graph software, and now using something a little more simple!

    That one worked a treat! So im gone ahead and ruined it all and changed the graph im using, the new input data is as such :

    line1: [20, 45, 75, 33, 51, 85],

    But the data from this :

    $str=file_get_contents("sr.txt");
    $str=preg_replace('/\s+/', '', $str);
    $parts=str_split($str, 4);
    print_r($parts);

    is coming through as this :

    [0] => 2267
    [1] => 2288
    [2] => 2258
    [3] => 2277
    [4] => 2248
    [5] => 2219

    I just need the numbers as such : 2267, 2288, 2277 etc etc....

    Any help?

    Please & Thankyou!

    Comment


    • #17
      Ahh ok, i think i may have confused you, im no longer using that graph software, im using something else.

      The syntax requirement for the line values (ie. what i need to print from my txt file) is like this :

      Code:
       lineData: {   line1: [20, 45, 75, 33, 51, 85] }
      So each value just needs to be following by a ,

      The previous syntax is no longer needed.

      Sorry!

      Please & Thanks!

      Comment


      • #18

        Yeah I've since changed the graph software, and
        am now using something a little more simple.
        Well, that is rather silly, isn't it.

        The code that I provided was made for a specific application.

        Why would you assume that it would work OK for another.

        Perhaps the simple thing to have done, was to have provided an actual link to it.
        Last edited by coothead; 09-11-2016, 04:06 PM.


        ~ the original bald headed old fart ~

        Comment


        • #19
          Ohh im sorry, well im using this now :

          https://codecanyon.net/item/grafikon/11244153

          Comment


          • #20

            So you bought it then?

            I cannot see any code to play with.


            ~ the original bald headed old fart ~

            Comment


            • #21
              Code:
               
               line: {    YData: [25, 50, 75, 100],    XData: [ "2010", "2011", "2012", "2013", "2014", "2015"],    lineData: {       line1: [20, 45, 75, 33, 51, 85],       line2: [54, 75, 25, 25, 75, 65],       line3: [33, 51, 45, 66, 100, 73],    },    lineTitle: ["1st line", "2nd line", "3th line"],    lineColor: ["#2a9c8a", "#be4f44", "#54314d"]     coordLineColor: "#666",    pointOrbit: true,    legend: "right"	 }

              Comment


              • #22
                I did buy it yes

                Comment


                • #23

                  I did buy it yes
                  Then I would suggest that you put all the files in a zip attachment for me to test.

                  Does that not make complete sense to you?


                  ~ the original bald headed old fart ~

                  Comment


                  • #24
                    I can do that, but right now all i need is an example of printing contents of a file, replacing line breaks with a comma

                    Comment


                    • #25

                      Don't hold your breath.

                      I am definitely not going to make wild guesses as to what is required.

                      Properly considered reasoning is obviously essential for coding.


                      ~ the original bald headed old fart ~

                      Comment


                      • #26

                        I forgot to ask, why have you discarded the charts here...

                        http://canvasjs.com/php-charts/

                        ... for which we have them working OK?


                        ~ the original bald headed old fart ~

                        Comment


                        • #27
                          For lack of customisation and branding

                          Comment


                          • #28
                            Originally posted by eddy-r3 View Post
                            I can do that, but right now all i need is an example of printing contents of a file, replacing line breaks with a comma
                            Code:
                            /* Get file contents */
                            $oldString=file_get_contents("sr.txt");
                            /* Replace Line breaks */
                            $newStr = str_replace(array("\r\n", "\n\r", "\n", "\r"), ",", $oldString);
                            /* Print contents */
                            echo $newStr;
                            Last edited by sbeynon; 09-13-2016, 05:58 AM.
                            Who needs a Signature?

                            Comment

                            Working...
                            X