After the implementation of graphs by means of GD and its functions, and its customization, which is not very broad today, I wondered if it was possible to implement the output of graphs using the means of ordinary blocks (divs). The size of the blocks set, perhaps labor for no amount.
But is it rational?
Are there any implementations? (additional author: there is - remembered Wikipedia.)
I noticed that when drawing graphs of more than 100 values ​​via GD, PHP is significantly strained and the script is no longer bright. (it’s not difficult to draw 100 blocks and paint in html for php) In a word, I want to hear the pros and cons of this or that subject of this issue.
(The question is relevant for linear graphs with the output of a single data array!)
Example as in pic .:

enter image description here

(I will add: I meant without using third-party libraries like charts, google.developers and flotr2)

  • four
    maybe better svg or canvas ? - korytoff
  • one
    I think the method is quite good, given that it is possible to attach different decorations like cue shadows, gradients and frames, etc., through each css div. and all this will be done by the browser automatically with each block. Only if there are not too many blocks so that the browser does not hang. - sercxjo
  • one
    And why not render graphics on the client using JS? There are a bunch of libraries for this, and no need to reinvent the wheel. - Dmitriy Simushev
  • one
    @sercxjo, by the way is a good idea. Test the same graphics in different implementations. It is necessary to collect div'ny schedule at your leisure. - I_CaR
  • one
    plotting graphs without using third-party libraries is similar to graphing using third-party libraries, but without third-party libraries) - PashaPash

2 answers 2

Building a series of div 's illustrating an array of values ​​is quite a simple working version. Let php give the data itself, and the graph draws the browser. If the number of values ​​in one graph to several. Thousands - for the browser should not cause problems.

Without libraries, take and write a few lines - there will be a schedule.

You show it to the customer. And he will ask, but let's add axes. And the captions under the values. It is a lot of values, therefore signatures only to everyone N-th. And so they were upright. And horizontal lines every 1000. No, every 1500. And tooltips when you hover the mouse. Etc. - fantasy works well, looking at a lively schedule.

In such a situation, you will eventually write your library. Therefore, maybe it is better to immediately take a gun and bang on sparrows? Say, my favorite D3.js , where even chips are already provided and implemented, for which the customer has not enough imagination. For your task, here is an example of a simple bar chart on it.

    may not understand the question - but the graphics are traditionally drawn js. With the help of php \ ajax you get an array of points and display it. in div. libraries darkness here

    pretty simple and cooler

    wrote a second sales