Is it possible to generate chart as PNG using this module?

Is it possible to implement getImageURI() function described here https://developers.google.com/chart/interactive/docs/printing#overview ?

Comments

dreamer777 created an issue. See original summary.

dreamer777’s picture

Issue summary: View changes
andileco’s picture

Yes, it is if you use the Highcharts library for your charts, but you need to add an additional .js file (exporting.js - see http://www.highcharts.com/docs/export-module/client-side-export and note the script tags on the page)

I enable the feature using a custom module containing the following code:

function YOURMODULE_library() {
  $libraries['highcharts'] = array(
    'title' => 'Highcharts Libraries for YOURMODULE',
    'version' => '1.0',
    'js' => array(
       libraries_get_path('highcharts') . '/js/highcharts.js' => array('group' => JS_THEME, 'type' => 'file', 'weight' => -20),
       libraries_get_path('highcharts') . '/js/modules/exporting.js' => array('group' => JS_THEME, 'type' => 'file', 'weight' => -19),
     ),
  );
  return $libraries;
}
function YOURMODULE_init() {
    drupal_add_library('YOURMODULE', 'highcharts');
}

It's important that these .js files load after jQuery.

dreamer777’s picture

andileco, thank you for great solution!
Unfortunately, I use Google charts. Any ideas on this?

If I will not find one, I will need to move to highcharts.

andileco’s picture

Status: Active » Closed (outdated)

Since D7 is no longer officially supported, I am moving all D7 tickets without a patch to "Closed, outdated."