I have a project to draw relationships between different elements determined on a sheet.
When the user has finished making the plan, it can export it to a txt file that contains the links.
A bit like MS Visio but with only three or four elements draguable.
Does anyone have an idea of this project using web languages (php, js) ?
Thank you in advance.
I am not so sure of your question but if you want to draw graphs using php variables with javascript, then the html5 canvas is probably your best bet in terms or proffessionality with design and implementation.
Only downside is it is javascript only, and the user must have a browser that supports canvas.
Take a look at Raphael, you can make your users draw anything you want, export the structure as JSON,for example, and treat it with any language you want
Take a look at this Raphael example to see an interconnected graph
Related
I'm using leaflet to draw maps and put misc layers on top of them.
I want to be able to create "print screens" of the maps in an automated fashion.
I know that first task is client side and second one is server side but I would like to know the steps to achieve this. For the server side I need solutions in PHP
For better understanding what I'm asking, think of a use case which could be generating reports which include images of maps
See the "Print/export" section in the list of Leaflet plugins.
Alternatively, use a headless web browser such as PhantomJS, that will allow you to load webpages without a graphical interface and take screenshots of them.
ers, I need to render OSM tiles on-the fly using PHP without downloading the huge 23GB or so OSM dump. I found this, but it seems to be dead. :/ By the way, I don't want to store anything. If anyone has any ideas, thanks ;)
By the way, I'm using it for a web mapping application for the Nintendo DSi. (link)
PS. I know I could use the public OSM tile sever, but I hate the tile styles. :P
Your question is very vague.
Instead of using the full planet you can download any custom area you like by specifying a bounding box using either the regular API or the Overpass API. The latter also allows you to filter for specific data, for example highways. Or you can use a country extract.
Alternatively you can just use different tiles if you don't like the default style. There are many many pre-rendered OSM maps with different styles. For example Cloudmade offers a huge choice of different styles and you can even create your own one.
A third option is to look at one of the many other rendering applications for OSM.
And whether you are allowed to use the official tiles or not depends on the tile usage policy. Note that there are also (different) policies for tiles from different providers.
I interested, how can i draw 3d image in runtime using PHP,JS. (or what other programming language suggested for this..)
Specfically: I have a database-table with two filed. user and candle. For example Michael,100 means that Michael has 100 candle.
If i have a 10x10 candle image how can i use this image to draw a "3d candle image", something like this
So i have for exapmle a 300x300 DIV and i would like to fill in with the candle.png in 3d style. If the user have 3 candle in the database, then fill in with 3 candle randomly, if user have 30 then fill in with 30 candles..
Please help me how can i start this?
Rendering 3d graphics, while possible, is not really what php and javascript are created for.
If you are looking for a method of outputting pre-rendered images of candles to your page, then this is very easy with these languages, however I think you need to make your question more specific for a useful answer.
If you can run arbitrary code on your server, I recommend creating a program using something like http://liballeg.org/ that runs with CGI and querying it from within javascript. I think you are looking for what is called an affine transformation; look it up; I believe that allegro supports them.
How to approach this depends on how you want it displayed to the user, for example, if the user should be able to rotate the image then it would need to be done close to the user, ie on the browser.
If it is just a static bitmap is the final outcome then doing it on the server may be best, for performance.
Either way, it is a great deal of math involved, but I will assume you know the mathematics.
In order to do it in PHP you can use gdlib to save the image, and look for any examples in C on doing raytracing. It will be slow, and will be a performance hit on your webserver, but there are solutions to that.
If you want to do it in javascript, then your best bet would be to use the 3D canvas (https://wiki.mozilla.org/Canvas:3D), but this has very limited browser support at the moment, but it does give you access to an openGL API.
I'm working on a biology web based application and trying to figure out what language to use. The features I need to include are:
Image viewing frame - This area will display the current image that the biologists wish to see. The application needs to take in a number of coordinates from a file and draw those points on the image displayed here. When the biologist wishes to change images there needs to be no flickering from the refresh. Will do this using multiple image buffers probably. Content needs to be scrollable and able to be zoomed in.
There need to be labeled buttons that advance, step back, zoom, and play the images displaying in the image frame. There also needs to be some type of list view where images titles can be selected to be displayed.
There will be a bunch of folders of images on the server that can be selected from. The application must allow the user to select which folder of images to be loaded. It also must be able to read from either an txt or xml file and visually display the information there by way of line graph.
Would like to be able to run scripts on the server from the application.
I feel that all these things are doable by a web application but I have no idea what language to use. Most people recommend php, but i don't want to delve deeper until I know what its limitations are. Any suggestions are welcome. Thanks in advance.
-Mike
PHP can do everything you need for the back end, but most of the stuff that you describe is UI based, and this is dependent on the client, which is, of course, the browser. For highly graphical projects, you can do a lot in JavaScript and some JavaScript libraries have a lot of these capabilities built in. You might also consider Flash or Flex.
You might even consider a desktop application that runs outside of the browser. You can use Java, which is easy to deploy, but still requires the user to have the Java Runtime Engine, or you could go with a language that you can compile down to a native application.
Regardless of the front end technology that you choose, you'll still need a back end, and PHP can handle this.
You will find almost every server side platforms such as php , asp.net, asp, etc will do all of the above.
PHP is a language that resides on the server and handles all requests. Javascript (and associated libraries) is a language which is executed by the client's browser and handles (almost) all interaction. PHP is definitely able to do what you want, but for the interaction stuff (particularly the zoom, scrolling, etc.), you'll also need to use Javascript.
So, short answer, PHP is good, but you're going to need to use client-side scripting as well.
PHP is more than capable of doing this. You are going to need to use it in combination with some Javascript to handle the client side effects you describe. I would look into modifying galerific for your needs and then whip up some javascript to write points over the images.
From your concerns about image refresh/flicker, it really sounds like a desktop app is what you are looking for, for a rapid response on image changes. The requirements on this really seem to need to be defined better before you can choose a language... PHP can do all the server side stuff you mentioned, but you might have a harder time getting the image viewing "frame" to provide the functionality you want.
Due to the image manipulation requirements it might be easier to go with something like flash with a php backend or asp.net with silverlight. It might be difficult to prevent flicker and delays with using pure javascript as opposed to flash/silverlight.
Image viewing frame
This will most likely need to be done on the client side using tools/frameworks such as jQuery, the canvas element, silverlight, or any of the other 100's that are out there.
There need to be labeled buttons that advance, step back, zoom, and play the images displaying in the image frame. There also needs to be some type of list view where images titles can be selected to be displayed.
PHP or any other server-side scripting language could pull this off. If this is meant to be a quick project running on free/cheap hardware then PHP would be a good choice. If the plan is a large application that will have to be maintained over the course of many years and hosting/price is not an issue then I would suggest something like ASP.NET
There will be a bunch of folders of images on the server that can be selected from. The application must allow the user to select which folder of images to be loaded. It also must be able to read from either an txt or xml file and visually display the information there by way of line graph.
Again any server side language could do the folder listing portion. As for reading files and creating graphs, this would most likely be a combination of server side and client side programming. jQuery for example, has plugins that could quite easily take a xml file and create a line graph.
Would like to be able to run scripts on the server from the application.
PHP, ASP.NET - both could do this. I'm sure many others could, but these are the ones i use most often
The issue with PHP is that quite often, the code turns into a mess over time. This is maybe not so much an issue with the language as the people using it and the purpose the app was built for (a quick, one time project). Classic ASP also has the same issues.
ASP.NET is a good combination of OOP programming that allows you to separate presentation from logic with minimal effort.
I want to take data from a table that'll be almost exactly similiar to the one below, but have it in a line graph. The date values would be on the Y-axis, and it would plot the XP values on the X-axis. Since the numbers for each user vary, I'd need a way to make the distance between each point plotted "relative", I guess.
Example table http://img687.imageshack.us/img687/4175/tablel.png
Any suggestions?
If you want to generate a static image of the chart you could use Libchart or pChart for PHP.
It's better to get the data from the data source, not from the rendered table. Anyway it's two separate questions: how to take data from a table and how to draw a graph.
Drawing a chart in PHP is pretty easy. HTML/CSS can be used to draw a bar and PHP to calculate the bar length.
Or if you want to go the JavaScript route, maybe Raphaël.
I would go for HighCharts.
If you're using a linux/unix platform, you probably already have Gnuplot installed. Gnuplot can take a plot file and a datafile and generate an image, thus:
History.gnuplot, which needs to be generate first:
set title "Rawr_satch history"
set xlabel "Time"
set ylabel "Ranking"
set output "rawr_satch_graph.png"
set terminal png color
set xdata time
plot "rawr_satch_xphistory.dat" with linespoints
Which assumes a data file rawr_satch_xphistory.dat has already been generated, formatted thus:
2010-03-06 385581123
2010-03-05 384895430
2010-03-04 382983388
People have also written interfaces into Gnuplot for most languages, for example PHP-GNUPlot. Gnuplot scripts can be quite complex, and you could plot multiple variables, etc.
I use and fully recommend the Google Chart Tools API. If you're looking for a simple line-graph, they provide a very simple API that you can call that requires no installation or configuration. Some of the documentation is confusing, but I've been able to figure it out with a little bit of patience.
All that is required is an IMG tag and point the src to the Google URL with the right parameters.
They also have a more interactive Javascript library if you want to provide more functionality later on.
I've used the following from PHP: Google Charts, Open Flash Chart, YUI charts (Flash), and AMCharts (also Flash).
They're all pretty easy to use and all have their pros and cons. If you want to show more than a single graph on one page, don't use Flash-based charts. It turns out browsers have trouble displaying a dozen Flash charts all at once. AMCharts is probably the most feature rich, but the options available depend on which of their chart packages you select, and configuration is pretty complex.