Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, great module! Totally works as needed. Thank you for all your work on this.
I have a situation where I need to create charts/graphs off of various table fields. Looking into utilizing the api from https://drupal.org/project/charts to do an alter on a field and append a chart to the output, and doing this wrapped in a custom module.
I'm wondering if anyone else has had this need, crafted a solution, etc, and if there is enough need to create an integration with this module.
Comments
Comment #1
duncan.moo CreditAttribution: duncan.moo commentedI used tablefield module to achieve precisely what you describe also using the Charts module. I did not create a module, just created a function in the template.php, but creating a module that brings in a tablefield formater would be perfect.
Comment #2
mark@keodesign.com.au CreditAttribution: mark@keodesign.com.au commentedI've built a basic implementation to display a tableField as a chart. It's currently not configurable (draws a column chart). I'm just going to see if I can tidy it up a bit and I'll submit a patch. At this stage I'm not completely sure about the approach I've taken, but it fits my use case.
Comment #3
mark@keodesign.com.au CreditAttribution: mark@keodesign.com.au commentedThis patch adds basic chart rendering support. Requires Drupal Charts (https://www.drupal.org/project/charts) to be installed to work. Have not added to dependencies as I don't think people want to have to install charts to use tablefield. I'm hoping it's possible to refine this to detect charts is installed and notify user that charts display is not supported without it.
Comment #4
mark@keodesign.com.au CreditAttribution: mark@keodesign.com.au commentedThis patch also detects the charts module is installed (and enabled) before offering the charts view.
Comment #5
mark@keodesign.com.au CreditAttribution: mark@keodesign.com.au commentedThis patch adds a label for the x, and the y axis where there are two columns. If the label is displayed for the y axis, the legend is not displayed (requires support in google charts).
Comment #6
mark@keodesign.com.au CreditAttribution: mark@keodesign.com.au commentedPlease disregard patch 5 - I've re-rolled it with the changes in place and it is attached.
Comment #7
kekkisTo me, this seems like a prime candidate for a separate module. This would solve the dependencies problem as well, not to mention keeping the structure clearer. I haven't done so yet but I did look into it a bit and found that it's not as simple as it sounds, having to do with fields (which I haven't... yet).
So @patrickfgoddard is in the right here IMO, suggesting creating a module around the integration rather than trying to patch it together with the original tablefield.module.
Anyway, I thought I'd let you know @mark that patch #6 downloads as UTF-16LE when I curl or wget it from its URL. I'm not fully aware of guidelines but I would seem to me that the optimal encoding is UTF-8. To that end, I'm attaching the same patch but with UTF-8 encoding.
Comment #8
thtas CreditAttribution: thtas commentedI've re-rolled the patch against the latest dev 2.x of tablefield and I'll work on creating a stand-alone module version.
Comment #9
thtas CreditAttribution: thtas commentedModule created
https://www.drupal.org/project/tablefield_chart
I've also added the ability to select which charts library to use for rendering, but it should fall back to the default one selected by the Charts module.
Comment #10
lolandese CreditAttribution: lolandese at HCL Technologies Limited commentedThanks to all for your contribution. I have included a link to Tablefield Chart on the project page of TableField.