The Comparison of charting solutions illustrates that it would be a major forena enhancement to add another charts renderer, something like a CGA Renderer, as an alternative to the existing, and amazing, SVG Graph Renderer. CGA being the abbreviation of Charts and Graphs APIs.
A (perfect?) name for this new renderer could be renderers/FrxCGA.inc.
Some of the Charting APIs (existing Drupal module for creating charts and graphs) that seem to be worth considering are:
Delivering such renderer would be beneficial to both forena, and to each of those modules involved:
- it would position forena as a module that virtually integrates with any charting library.
- it would allow any of these Charting APIs to be used for data stored in any of the external database formats supported by forena.
The main difference between this CGA renderer and forena's existing SVG Graph renderer would be at the level of the calls to the selected Charting API module, instead of calling the SVG Graph library. Specifying the Charting API module that should be enabled, seems to be like a (new) admin option, possibly with specific (new) permissions related to them. While for each report there might be a (new?) FRX option to specify which of the enabled Charting APIs is to be used for a report. Depending on things like licensing needs or supported features for any of the charting modules libraries (Highcharts, Google Charts, d3.js, etc), one could then pick the most appropriate combination for each reports.
Upgrading (or merging) the existing SVG Graph renderer into such CGA renderer could be something to be considered also.
Comments
Comment #1
Pierre.Vriens commentedComment #2
Pierre.Vriens commentedComment #3
gemalmI want to use forena module with d3js library. This feature looks like perfect for my purpose.
Have someone started with this?
I tried to do a git clone but I got errors and the reports (default and created by myself) couldn't be deleted.
Thanks :)
Comment #4
Pierre.Vriens commentedTo my knowledge, no issues or docu exists related to such d3js combination. However, if the "CGA renderer" as I wrote in the original issue would become available, I'd imagine that support for the d3 library would come with it automatically. Assuming we're talking about the same library (d3js vs d3), that appears to me like "a" valid approach to consider.
In the context of #2368793: Chart 2.0, I'd be happy to "help" addressing this issue. Also because of my #2368793-26: Chart 2.0 comment in it. Should we consider adapting the title / description of this issue to do so? Another reason to do so is because of what I recently learned about some other charting modules ... The most commonly used module for charting in Drupal is chart (over 25K sites), followed by charts (over 7K sites) ... The chart module is facing an end-of-live deadline of April 2015 (announced by Google ...). And the charts module seems to be suffering challenges in the area of support and documentation (not so for forena I think!), though it seems a valid successor of chart also.
Notes:
Comment #5
metzlerd commentedWe have not started any D3 support, but patches are welcome. There are easy ways to consume forena data as so it seems that any client side graphing solution would not be to hard to implement. I have not yet had any time to experiment. I'm familiar with the one notice error that you posted on the issue queue and will get to fixing it.
D3 nor any other php graphing technique will implemented in Forena will require the use of PHP as an input filter.
If you need assistance in figuring out how to access data using SQL data blocks in forena as JSON. File a separate issue with regard to that (just to keep the graphing issues separate.
Comment #6
Pierre.Vriens commentedDavid, regarding the
You're confirming what I was already assuming a bit. Can you briefly describe how to do so? Using forena terminology for me is fine. Is this something that can be compared to using dataTables in forena (via the skins, etc) to make "some" charting library (assuming it's a JavaScript) available? Or is it rather like a custom renderer, some type of clone of the SVGGraph renderer? Also: the "client side graphing solution" that you mentioned, is it correct to assume that all charting solutions that use some JavaScript (library) would fit in that category? FYI: there seem to be dozens of them, just look in my comparison to see some of the "popular" ones ...
Regarding your JSON suggestion: can we use #2362855: Details about forena's JSON fmt to use it as chart(s) input for that, or do you mean something else?
PS: depending on how this evolves, another way of explaining "forena" might become to "connect" with the charting solution (library) of your choice ... starting from data stored in your DBMS of your choice ...
Comment #7
gemalmHi :)
I have created a small module for using forena data with d3js library (http://d3js.org/) and using forena reports.
I will write here and if you want I can contribute in the documentation of forena module. I am sorry I haven't contributed to the forena module. It was easier to create my own module using forena reports. I think to explain how to use forena in your custom module is another way to contribute :)
In my module:
- I am creating a block for inserting a graphic wherever in my site ( I can create more blocks of course...).
- I am using libraries module (https://www.drupal.org/project/libraries) for using the library d3js inside my block.
- I am creating my own javascript file where I can use d3js library and I can pass parameters from my site like forena data using forena_data('customsql/gemaUsersSessions’); for example.
- I can insert forena reports in my block that I have created previously with forena module using SVGGrpah library.
gemacharts.info
gemacharts.module
gemacharts.js
Thanks for a great job with forena module and fast replies in the issues :)
Gema
Comment #8
Pierre.Vriens commented+100 (= +1 * 100 ...) to Gema for what's in #7. I only briefly digested it, but I think it's a great example. I'm curious to read the feedback about it from "Le Patron" (aka David).
Maybe we should consider adding some type of example module in forena, based on this example here?
For now I only have 1 curiosity: isn't it possible to get the required JavaScripts added via a forena 'skin', which then probably avoids the libraries dependencies (a variation of what I asked about in #6 also)?
PS: seems to me that it might make sense to start a new d3js related forena issue (Subject: custom module using d3js), and move our recent comments about that in this issue to it also.
Comment #9
gemalmHi Pierre.Vriens!
Thanks :)
I was also considering the option of using a forena "skin" but I am not sure if that's possible.
It would be nice to know the opinion of metzlerd :)
PD: I have modified my comment #7 for adding the way I am getting the json data in my javascript.
Have a nice weekend!
Comment #10
metzlerd commentedYes it is certainly possible. I generally don't use the libraries module unless it's needed by something else. You can certainly use skins to dynamically load javascript files. I wonder if it would be a good idea to create a sandbox project for collaborative work on this? I'd love to see us develop a really solid example of a d3 integrated library. There may be some helper js functions that we could add to forena.js to make this job easier.
Forena already allows for support of retrieving data blocks in json format, but there may be some advantage for thinking about how that data might need to be changed. But that would normally be done via an ajax call? Perhaps I could start to work on an example for that?
Anyway gemalm, if you are somewhat comfortable with git, would you be interested in collaborating on an example for this? We could decide to include the example into the forena project at a later date if we find this successful?
Comment #11
gemalmI am working on this.
Comment #12
metzlerd commentedGlad to hear it... would you be interested in collaborating via a sandbox project?
Comment #13
gemalmHi,
I am sorry because I had to start with another task and I had never created a sandbox project before although I am familiar with git :)
This is just a starting point and I have no experience with d3js so I haven't had time for creating the chart. But I had the data in the block for creating the chart.
This is the sandbox project I have created, https://www.drupal.org/sandbox/gemalm/2383267
:)
Comment #14
metzlerd commentedNo need to apologize. I was actually going to create the the sandbox for you, but just wanted to make sure that we had a common place to work. Would you mind temporarily granting access to me and then we can work together on examples. I've been studying d3 a lot lately. I think actually it may be a library that is really useful to use in conjunction with PHP SVGGraph as d3 is really a helper library for SVG generation rather than being a full fledged charting/graphing library by itself.
I've been starting to think about enhancements to Forena in terms of helper functions to generate these graphs and am interested in what you think you need from forena to get the data you need.
One of my coworkers is using a general strategy of using forena to generate some base SVG (in an .frx file) and then having D3 do manipulations animations and plug in data. I am starting to look at adding support to Forena to be able to populate data in JSON settings object properties, but there is already quite a bit of functionality for populating json based on data from forena using AJAX calls. I was wondering what approoach you were working on?
Comment #15
metzlerd commentedRegardless I created a sandbox project for collaborating and reporting examples. It can be found at https://www.drupal.org/sandbox/metzlerd/frx.
Comment #16
Pierre.Vriens commentedI don't have experience yet with "sandbox" stuff either, but would like to use the opportunity to learn about it. Any suggestions about some drupal.org docu somewhere that I should start digesting first? Also, maybe you (David) can explain in the context of this issue and/or forena what exactly we can/should try to use this sandbox for? Like how is it different from a typical DEV version of a release, or what you would expect participants in it to do or use it for?
Sorry if these are stupid questions ...
Comment #17
metzlerd commentedSorry wrong url ..... Corrected in original post.
Basically a sandbox is a GIT repos without the packaging scripts to make downloadable versions. In this case I've given all three of us access to the repos, so we can all check out and commit code until we get the features that we need. In this case, the frx module is not a copy of forena, but rather an example of a custom module that starts to include d3 libarary and stuff.
We can all create issues on that project, or continue the discussion here until we have something that we can really call D3.js support for forena.
I've actually made a couple of small commits to Forena to add some helper features in the 7.x-4.x-dev branch so the sandbox project should be used in conjunction with a git checkout of forena-7.x-4.x dev branch.
Comment #18
metzlerd commentedSee #2383509: D3 Strategy. for the issue on the project to continue this discussion on d3 integration. I will document the general strategy that I am taking there.
Comment #19
Pierre.Vriens commentedRephrasing the original issue description to also consider it for modules Chart and Charts, because these are the 2 most installed (popular?) modules, and because of their new (co-) maintainer ... who recently created quite a lot of community docu (linked on their project pages via 'read documentation) for these modules also ...
Comment #20
metzlerd commentedI looked briefly at these implementations and they seem to have a sane API for working with them. I don't have the time or need to implement them, but if you wanted to start working on one of them you could consider starting a sandbox or using the Frx Sandbox to start a custom renderer. We could then implement them after we got them working in the sandbox, and we wouldn't hold up the current releases for them.
You already have commit rights to https://www.drupal.org/sandbox/metzlerd/frx but if you want to start your own I understand. You could feel free to commit as much code as you like and that would give us a shared space to edit?
Comment #21
Pierre.Vriens commentedOk, the FRX sandbox you suggested should work for this (I'll leaving the fun for figuring out how to create one for a future opportunity). Glad to read about the sane API also!