1

I am uploading TXT and CSV files in a content type. While displaying it, I have to show that as a chart when users viewing the content of that content type.

I have tried using the Charts module, etc. Though I am able to plot the chart reading from a file by giving absolute path, I am not able to do it dynamically. Is there a better way of doing this (using Drupal 7)?

0
0

The Easychart module may be close to what you're looking for. It comes with these facilities:

  • Pasting of CSV data to create charts from it.
  • Entering an URL pointing to a CSV file containing the data to be charted.

For an extremely short demo of these facilities, have a look at this video.

It is a graphical user interface, using the Highcharts javascript library as its charting engine (which may require a commercial license though). It claims to support every Highcharts chart-type and option.

Some more details about this module:

  • It defines a new content type (= Chart) used to add charts to your site.
  • It creates a chart widget that can be used in your own content types.
  • It integrates with the WYSIWYG module and provides an editor button to add charts to your WYSIWYG content (CKeditor and TinyMCE are supported).
  • It provides an intuitive interface to configure charts through the Easychart plugin.
  • The Government of Flanders contains some real world examples of a Drupal website with some charts created with Easycharts (ignore the text on that page if you're not familiar with this language, just concentrate on the charts).

If you're using an URL pointing to a CSV file with data to be charted, then be aware of what's mentioned in comment nr 5 of the issue about "EasyChart data doesn't update unless I edit and save the chart node", i.e.:

For performance reasons, the external csv data is only updated when cron runs.

Resources:

Notes:

(1): To resolve an error like "Highcharts not defined" (as per your comment below this answer, you may want to have a look at the issue titled "Highcharts is not defined". Comment # 2 in it includes a possible explanation for that error, ie:

It was a permissions issue on the library. For some reason the highcharts library had permissions set to: drwx------@

This worked fine on my local machine, but not on shared hosting. I changed them to: drwxr-xr-x to match all the other libraries.

(2): From the Easychart project page:

Make sure to clear the website's css-js cache after installing the javascript dependencies

(3): The Highcharts library needs to be placed in /sites/all/libraries/highcharts (as mentioned also in the README.txt)

4
  • Yes I went through this post already. But I am getting Highcharts not defined error because of which I am struggling to find a solution using easychart. The error is shown in console.
    – Sundar
    Feb 17 '17 at 8:00
  • Thanks a lot for commenting. I tried providing permission through windows cmd using icacls. Still no use. Highcharts is not defined in ec.min.js. FYI, I have extracted highcharts folder into all/libraries of drupal along with easychart and jquery.cycle(which I am using it for slider)
    – Sundar
    Feb 17 '17 at 9:02
  • Yes thats where exactly I added. And highcharts folder has all the permissions as like easychart. But drupal is not able to read the highcharts js. I am getting the same error with or without highcharts folder.
    – Sundar
    Feb 17 '17 at 17:21
  • Atlast found that easychart module in expects file path for highcharts as js/highcharts and recommended version is highcharts4.2.7. In highcharts 5.0.3, the folder structure got changed to code/js/highcharts.js. When I replaced with the recommended version of highcharts4.2.7, easychart appeared without any problem.
    – Sundar
    Feb 18 '17 at 6:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.