0

Why would you do such thing??: because in some particular cases I need to hide the source values of a graph generated by dygraph. Since in the case of "not hidden values" I am using dygraphs js libray, using this particular feature would save me a lot of time.

This way I would have the same look and feel, and I would not have to modify the data generation process.

I would like to know if this road is feasible or utter madness:

Steps: (using Yii-PHP over an Apache server)

  1. Generate javascript page on the server side.
  2. Get image as png (somehow), still on the server side.
  3. Send the image to the client as the only thing he can receive.
3
  • 1
    If in your use case the dygraph library is meant to be used on the client-side, why not use a charting library for PHP that is meant to be used on the server-side? Commented Sep 2, 2014 at 7:43
  • why not use a charting library for PHP that is meant to be used on the server-side? : because unfortunately (and due to legal restrictions) I need to mix in the same webpage both styles. 1. full dygraphs js features, 2. image graphs in order to stop people form parsing the data. As I said, using the same dygraphs look and feel would have two advantages: the most important is having the same look and feel for both types of graph, and the secondary one is not having to change the a single comma in our data generation functions (a PHP library would certainly use a different data format). Commented Sep 2, 2014 at 7:58
  • In that case, see @Amadan's suggestion below to use a headless browser, such as PhantomJS. Commented Sep 2, 2014 at 8:02

2 Answers 2

2

There's a ton of graphing libraries for PHP, why not use one of those? (e.g. JpGraph, pChart...) Pretty much every one of them can produce an image in PNG.

Feasible steps:

  1. Invoke a PHP graphing library on server side
  2. Render it as PNG and send to the client

If you insist on using a JavaScript library, then I guess PhantomJS is your only option, but it is not exactly optimal.

tl;dr: My vote goes to "utter madness".

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much. I know it looks like utter madness, but it would certainly reduce our problems (as I have further explained after @Boaz 's question in the main post). Your hint has lead me to PHP PhantomJS, which looks promising, and this Stackoverflow post explaining how to Execute PhantomJS from PHP. I think it is worth to give it a try before we switch to the "feasible solution" (the PHP generated chart), which would have the "look and feel" disadvantage.
0

Some dygraphs users have built a tool for exporting PNGs: demo and discussion.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.