-1

I have got the mission do develop "Charts Generator" which will be able to generate .html files with the specific (pie, column etc.) chart and save it on the server.

The main challenge is to find JS framework which will be able satisfy the up mentioned needs. Frameworks like google-charts or angular-chart are creating their charts on-the-fly (e.g. when the page loads) but in my case it is not what I need. Let me explain it with an specific user story.

For example the end-user wants to print his month bill (with column chart inside). He receives the generated .html file, right-mouse clicks it and selects to print it. To make sure that the chart will be printed correctly, it has to already to be in the .html file (e.g. presented as img element).

Any suggestion for frameworks that could help me?

altgov3en
  • 1,100
  • 2
  • 18
  • 33
  • you can use `chartjs` or `chartist` or `highcharts` for javascript chart. – yash Sep 19 '16 at 06:51
  • @yash, those are gorgeous libraries but all of them generates their charts on-the-fly (e.g. chartjs draws its charts on canvas element). I have to generate the chart once and for all (e.g. as an img or block of html) – altgov3en Sep 19 '16 at 07:09
  • you could still use google charts, during the creation of the html page -- use the method `getImageURI` to convert the generated chart to an image, then save the html and send it -- [here is an example using php](http://stackoverflow.com/a/38678667/5090771) – WhiteHat Sep 19 '16 at 11:42
  • In my opinion d3 is a good option for your requirements – S.Dan Sep 20 '16 at 05:37

3 Answers3

0

There is a library called jsPDF, that allows you to generate static pdf files from html. Also you could achieve it with a server-side language, that would create these files on user ajax request.

maciejmatu
  • 572
  • 1
  • 8
  • 14
0

You can consider to use a server side chart generation library like ChartDirector. It can be programmed using server side languages such as PHP, Python, C#, Java, or even C++, and generates charts as images (as PNG/JPG/SVG). The code can then include the chart images in HTML by using <IMG> tags. You can even include those images in HTML inline by using the data URI scheme. In this way, no Javascript is required and the entire "monthly bill with the chart" will be in a single HTML file.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
user3100235
  • 127
  • 3
0

You could do this from Java using JFreeChart and JFreeSVG.

David Gilbert
  • 4,427
  • 14
  • 22