Ignotas Posted July 25, 2013 Share Posted July 25, 2013 Hello, I am making a statistical web program. After I sort and load phone numbers in table I need to make a function that will draw graphs for those phone numbers, I have made that and it works, but before it creates these graphs it needs to run few functions to generate data for them to be drawn and becouse there is a lot of types of graphs there is a lot of functions and already the page is loading to long. So what I want to do is after the phone numbers have been checked and I press a certain button for type of graph, that it would run those funtions without reloading the page and graphs would be show in something like Facebook gallery(but right now thats not important). I think maybe it could be done with JS somehow. Thank you for your answers! Link to comment Share on other sites More sharing options...
niche Posted July 25, 2013 Share Posted July 25, 2013 (edited) You're generally correct, except I think you'd have to render the graphs in JS and JS may not solve your wait issue. If you go with JS you'll need to review this link: http://stackoverflow.com/questions/6946993/any-good-javascript-graph-library EDIT: and probably this link: http://www.w3schools.com/php/php_ajax_intro.asp Edited July 25, 2013 by niche Link to comment Share on other sites More sharing options...
Ignotas Posted July 25, 2013 Author Share Posted July 25, 2013 First I would like to try running my php functions, becouse I spent a lot time of making them. Maybe I could run another .php file in server or somehow without showing it to the user ? Link to comment Share on other sites More sharing options...
niche Posted July 25, 2013 Share Posted July 25, 2013 (edited) For what purpose? EDIT: The more php, the more time. Think of php as a packaged deal and JS as a la carte (in terms of user time). If you're going to change now's the time to do it. Edited July 25, 2013 by niche Link to comment Share on other sites More sharing options...
Ignotas Posted July 25, 2013 Author Share Posted July 25, 2013 That file would have those functions, one for creating right format data, and other for rendering my chart and then using JS I could show the rendered picture in previous page. Link to comment Share on other sites More sharing options...
Ignotas Posted July 25, 2013 Author Share Posted July 25, 2013 I understand that it would take some time, but not as much if I would make all functions to run when I load the page for the first time, or realod again the main part and then + some other functions. I need to have same page but to run more PHP and add to that page. Link to comment Share on other sites More sharing options...
niche Posted July 25, 2013 Share Posted July 25, 2013 Original problem solved. All that's left is the refresh issue that might not be an issue at all if you split it up.. Link to comment Share on other sites More sharing options...
Ignotas Posted July 25, 2013 Author Share Posted July 25, 2013 The orginal problem was the refresh problem. So you still recommend to use JS for my graphs ? I made so much with PHP that it would kill me now to restart. Also the data comes from csv file and I don't think that JS could deal with it. Link to comment Share on other sites More sharing options...
niche Posted July 25, 2013 Share Posted July 25, 2013 You've split-up your php so you've minimized your problem. You need UX to determine if it's still a big enough issue to for JS. Without more info about the user situation I can't direct you. For example if it's a backroom consumer or B to B experience, you're probably OK. If you're trying to make a sale, probably not. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 25, 2013 Share Posted July 25, 2013 I'm not sure what the output of your graphing function is, but you can use Javascript to send an ajax request to a PHP script to run the code. I'm not sure what you would do with the response, but that's how people run things on the server without reloading the page. Link to comment Share on other sites More sharing options...
Ignotas Posted July 26, 2013 Author Share Posted July 26, 2013 Thank you I'll try that, the out put for data is .txt file and the rendered graph is .png format, so if it would run it in server I can upload that picture back easily. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now