I
I
Igor Vasiliev2017-07-26 19:16:31
Programming
Igor Vasiliev, 2017-07-26 19:16:31

On what to draw SVG, what software solution?

Hello dear Toster users.
---
fa5a490a59024cc5b88e7a36dc69d6bd.png
Please read my question very carefully.
==
Background: Here is one example of an interface showing a graph.
It says:
PRODUCTS YEARLY SALES
--
If you look at the source code, you will see svg there, sometimes canvas.
So, imagine a situation where you sell gadgets, for example, and you
have sold:

за апрель - 1500 шт.
за май - 4000 шт.
за июнь - 6500 шт.
за июль - 9000 шт.

===
If you draw the X and Y
axes on paper , then you get a kind of curved exponential function, from dates (months), and quantities.
But in the graph from the example, you can see that there are lines in waves. It would be possible to draw on pure css, and then bathe with adaptability, in the case of svg, the need to adapt disappears, because it is enough to specify the size of the picture as a percentage, and the graph will shrink and decompress without losing the exact data. Plus, there are interactive data, highlighting of individual elements, tips.
===
I will not use this site or this design specifically, this is just an example.
===
I'm good at php, not so good at javascript, and terribly at python.
===
I will write the info to a file, in the form of a svg file , which will be displayed in Via . The data will be stored in the database, in the form of numbers:
<div id="chars"></div>
javascript
04 / 1500 
05 / 4000
06 / 6500
07 / 9000

To be deduced on the last for example 10 records.
How it will work, I imagine. From some store on the Internet, numbers come through the API and are written to the database, presumably php or javascript, will perform calculations, and write data to svg, in real time.
I will also update the chart through javascript.
===
I did not indicate the exact data, but an example, so that there is specificity, everything will probably work differently, the script that will read and draw all this remains unchanged.
QUESTION: It is obvious and banal, on what to write code for drawing such graphs? Is there a ready solution, is javascript or php suitable for this task? Or can and should python do this task?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Koch, 2017-07-26
@Isolution666

Why reinvent the wheel?
www.chartjs.org - Able to update "on the fly" and the api is quite simple.
There are examples there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question