The current charts d7 dev version simply doesn't work. This patch at least gets you somewhere.

Comments

mattbk’s picture

Are the developers working on this anymore? A patch from three weeks ago that hasn't even been commented on sort of makes me worry about D7 support (and of course, I can't even make Charts work at this point).

What does this patch do, specifically?

berenddeboer’s picture

What the patch does? Make the thing actually work!

ununpentium’s picture

It would have been more helpful to mention what the patch does - or what to look for as an admin user - instead of just saying it "gets you somewhere", for, after applying the patch, it indeed does not.

After applying the patch, I noticed a "configure" link (admin/config/system/charts) appears for Charts on the modules list page. Clicking "configure" creates a blank page. Forcing a return/refresh of the modules list then produces a repeating list of warnings and notices. Here are the errors without showing duplication (this is on a new D7 install, and new Chart module install - no upgrades):

Warning: asort() expects parameter 1 to be array, null given in _charts_settings() (line 128 of /[path to drupal]/sites/all/modules/charts/charts.inc).
Warning: array_keys() expects parameter 1 to be array, null given in _charts_settings() (line 129 of /[path to drupal]/sites/all/modules/charts/charts.inc).
Warning: current() expects parameter 1 to be array, null given in _charts_settings() (line 129 of /[path to drupal]/sites/all/modules/charts/charts.inc).
Notice: Undefined index: in _charts_settings() (line 133 of /[path to drupal]/sites/all/modules/charts/charts.inc).
Warning: array_fill_keys() expects parameter 1 to be array, null given in _charts_settings() (line 133 of /[path to drupal]/sites/all/modules/charts/charts.inc).
Warning: asort() expects parameter 1 to be array, null given in _charts_settings_form() (line 143 of /[path to drupal]/sites/all/modules/charts/charts.admin.inc).

berenddeboer’s picture

But no further output? You can ignore the warning stuff.

ununpentium’s picture

Right, no output - blank page after clicking "configure".

robloach’s picture

Title: Patch to make D7 charts module work » Make Charts work in Drupal 7
Priority: Normal » Critical
StatusFileSize
new16.35 KB

Here ya go!

adam_b’s picture

subscribe

ced.cornez’s picture

StatusFileSize
new48.1 KB

Thanks Rob Loach

Here is a slightly enhanced patch, which (among others) displays examples of charts on the admin page, and let you choose if you want labels or not (like in version "charts" for Drupal 6)

liquidcms’s picture

mostly patched... will try to fix manually

(Stripping trailing CRs from patch.)
patching file charts.admin.inc
(Stripping trailing CRs from patch.)
patching file charts.hooks.inc
(Stripping trailing CRs from patch.)
patching file charts.info
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file charts.info.rej
(Stripping trailing CRs from patch.)
patching file charts.install
(Stripping trailing CRs from patch.)
patching file charts.module
(Stripping trailing CRs from patch.)
patching file charts_color.js
(Stripping trailing CRs from patch.)
patching file charts_system/charts_system.hooks.inc
(Stripping trailing CRs from patch.)
patching file charts_system/charts_system.inc
(Stripping trailing CRs from patch.)
patching file charts_system/charts_system.info
(Stripping trailing CRs from patch.)
patching file charts_system/charts_system.module
(Stripping trailing CRs from patch.)
patching file fusioncharts/fusioncharts.hooks.inc
(Stripping trailing CRs from patch.)
patching file fusioncharts/fusioncharts.inc
(Stripping trailing CRs from patch.)
patching file fusioncharts/fusioncharts.info
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file fusioncharts/fusioncharts.info.rej
(Stripping trailing CRs from patch.)
patching file fusioncharts/fusioncharts.install
(Stripping trailing CRs from patch.)
patching file fusioncharts/fusioncharts.module
(Stripping trailing CRs from patch.)
patching file google_charts/google_charts.hooks.inc
(Stripping trailing CRs from patch.)
patching file google_charts/google_charts.inc
(Stripping trailing CRs from patch.)
patching file google_charts/google_charts.info
(Stripping trailing CRs from patch.)
patching file google_charts/google_charts.module
(Stripping trailing CRs from patch.)
patching file openflashchart/openflashchart.hooks.inc
(Stripping trailing CRs from patch.)
patching file openflashchart/openflashchart.inc
(Stripping trailing CRs from patch.)
patching file openflashchart/openflashchart.info
Hunk #1 FAILED at 3.
1 out of 1 hunk FAILED -- saving rejects to file openflashchart/openflashchart.info.rej
(Stripping trailing CRs from patch.)
patching file openflashchart/openflashchart.module
(Stripping trailing CRs from patch.)
patching file views/charts.views.inc
(Stripping trailing CRs from patch.)
patching file views/charts_plugin_style_chart.inc
liquidcms’s picture

yup, works.. able to get this in my View: http://screencast.com/t/hnwxMZoR

need to find docs on config options so i can get rest if info on chart.

obviously a proper views handler would do wonders for this module..

Francesco1910’s picture

@ced.cornez can you upload me a patched versione of charts?

I'm sorry but I can't patch the module! :(

ced.cornez’s picture

StatusFileSize
new31.69 KB

As my patch seems broken (some users cannot get it working...), here is:
1) My contribution to charts in D7
2) A new provider for charts, google_charts_2, that is using the new JavaScript dynamic API of google
Enjoy

liquidcms’s picture

perms hook in module above is wrong for D7 and will cause your admin/perms page to wsod.

replace with:

/**
 * Implements hook_permission().
 */
function charts_permission() {
  return array(
    'set default settings for charts' => array(
      'title' => t('Settings for charts'), 
      'description' => t('Edit the settings for all site charts.'),
    ),
  );
}
astutonet’s picture

I confirm.

The changes in the file made ​​available in #12 cause an error in Drupal that prevents access to page "admin/people/permissions."

In my case I see the following error message:

Fatal error: Unsupported operand types in C:\wamp\www\drupal\modules\user\user.admin.inc on line 696

As a result, it is impossible to access the permissions page and change your settings.

ced.cornez’s picture

StatusFileSize
new32.25 KB

You're right, my mistake! Here is the corrected version.

Thanks

astutonet’s picture

The new version also presents problems. The following message is displayed after activating the module and try to access the user area:

An unexpected error occurred on the site. Please try again later.

Tks

ced.cornez’s picture

Hum... What do you mean exactly by "The user area"?

I tried those urls, and I don't see any error...
http://localhost/admin/reports/charts/users
http://localhost/user
http://localhost/admin/people
http://localhost/admin/people/permissions

Also, have you disabled/re-enabled the module after the update to the last version? Or cleared the Drupal cache?

Don't you have any issue loggued on http://localhost/admin/reports/dblog to help me find the issue?
What charts provider do you use (I use google_charts_2)

Regards,

astutonet’s picture

The Charts module was disabled before I install the new version. I simply deleted the old version and unzipped the latest version in the area of modules.

After that, I cleaned the cache and active the Charts and Google Charts 2 modules.

Was when the problems appeared. I had no access to http://localhost/admin/people.

After this, I disable it again, cleaned the Chache and restarted the process. This time, I enabled only the Charts module. Then, the access permissions area was normal.

Then, I enabled the Google Charts 2 module and the access to the area of permissions continued to operate. Therefore, I believe there was another problem that I still could not identify.

If there are problems, I bring here

Sorry.

Thank you.

Jukebox’s picture

I installed and enabled the modules from #15, and it seems to work OK, except that this notice appears:

Notice: Undefined variable: chart_options in _google_charts_2_render() (line 92 of /.../sites/all/modules/google_charts_2/google_charts_2.inc).

makepu’s picture

I also installed the corrected version. I am able to configure the chart options on the admin page, but the changes won´t appear in my chart i built in views. In views i still get the same options i had before installing the module. How do apply the changes made in the charts configure page to my excisting views?
The documentation for charts in Drupal 6 says that there should be much more options in Views for configuring the chart. But alll these options don´t appear in Drupal 7 Views.

mattbk’s picture

Notes:

- Before you can access the Settings page (yes, there is one) for Charts, you need to turn on the "Settings for charts: Edit the settings for all site charts" permission.
- The settings page is located at admin/config/system/charts

Making progress on this using the version from #15, (charts_d7beta_20110412.zip). As far as I can tell, this version is more up to date than the official D7 dev version (I say this because it seems to work more).

There are fewer errors on the config page when I have both the "Google" ("Use Google Charts on your site") and "Google Charts 2" ("Use Google Charts 2 (Dynamic JS) on your site" modules enabled. This is what I get:

Notice: Undefined index: #label in _charts_settings_form() (line 187 of /var/www/nodakpaleo/sites/all/modules/charts/charts.admin.inc).
Notice: Undefined index: #legend in _charts_settings_form() (line 192 of /var/www/nodakpaleo/sites/all/modules/charts/charts.admin.inc).

No errors at all on the config page when the "Google Charts 2" ("Use Google Charts 2 (Dynamic JS) on your site" module is disabled.

Still can't create a View, however, even with a complete uninstall/reinstall of the module.

Pun-1’s picture

I'm posting here, because this seems to be the most active thread -

I am able to get the pie charts working - (without using the 1.x-dev) - and I'm willing to help anyone out with making the view - it took a while to figure out - this is a good resource Aggregation setting

I am having a problem which was supposedly fixed in version 6 Views Charts grabbing chart title from views basic settings 'name' field instead of 'title' field

Another issue was the labels not displaying correctly on a pie chart - a programmer I hired through this in a custom module - so I don't know if it can be incorporated or not...

function date_hour_chart_color_schemes_alter(&$schemes) {  //print_r($schemes); die;
 $schemes['default'] = array(
 '#FF00FF',
 '#003300',
 '#FF0000',
  );
 }
 
 function date_hour_chart_alter(&$chart) { 

 $i=0;
  foreach( $chart['#data'] as $key=>$value) {
      if($i==0) {  
	  variable_set('lb',$value);
	   $i=1;
	   } else {
	     $val = variable_get('lb',$default = NULL);
	     $lbl['#labels'][] = $val. ' : '.$value;
		 $i=0;
	    }
	  } 
	  foreach( $chart['#data'] as $key=>$value) {
      if($i==0) { 
	   $i=1;
	   } else {
	     $chart_new['#data'][] = $value;
		 $i=0;
	    }
	  } 
	  $chart['#data'] = $chart_new['#data'];
	  $chart['#labels'] = $lbl['#labels'];
 }
lstirk’s picture

How do you get the view working for this? It doesn't even show up as a format

Pun-1’s picture

StatusFileSize
new1.73 KB
new466.94 KB
new349.9 KB

Um...I don't know - I guess the answer to your question is views does the formatting???

here's what I did

1) Use views/aggreagation to get data into a table format
2) Change table into a pie chart

Pie chart would work - but labels didn't - For example in the table I would have like

Project - Time Spent
Horse - 3 hours
Swine - 2 hours

But it would put the label as "Time Spent" - instead of each indiviual project

Next - I paid someone who knew php to get the labels workings correctly. It's not really a module I can contribute back or I would - because it was customized to fields I already had. But here is the whole module and some screen shots...

quicksketch’s picture

I've updated the D7 version with these patches to get it moving:

#1579254: Charts implements hook_requirements incorrectly
#942684: Fix charts breakage due to #497118: Remove registry (for functions).

This issue with just a zip file is too sweeping to act upon. Could we make separate issues for all the changes being suggested? There's some good code in here but it needs to be broken up into smaller, reviewable chunks (and as a patch).

quicksketch’s picture

Status: Needs review » Fixed

In the end I gutted most of the 7.x-1.x version and rewrote it as 7.x-2.x I'd recommend trying that version if you're needing charts in D7.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.