Hi,

I have the following code for creating a map in Drupal 7 however only the title is showing, could someone point me to where I'm going wrong?

$map = array(
      '#chart_id' => 'visits_by_country',
      '#type' => CHART_TYPE_MAP,         //Map Type
      '#countries' => array('MG','KE','TN'),   //Array of ISO country codes (2 letter codes)
      '#georange' => 'africa',                    //Geographic Range of the Map - continent name or 'world'
      '#data' => array(10,50,100),        //Value affects intensity of colours which will be in the range defined by #data_colours second and third elements
      '#data_colors' => array('ffffff', 'edf0d4', '13390a'), //3 values for the colour (all other countries, start colour and end colour)
	  '#size' => array('#width' => 750, '#height' => 250),
	  '#title' => t('5616'), '#436C30', 15,
    );
$page_content .= theme('chart', array('chart' => $map));

Many thanks

Comments

StChat’s picture

replace '#size' line with this
'#size' => chart_size(750, 250),

it works but not for all values .. I have no idea why.

pwhite’s picture

Thanks for that, unfortunately its still not working - any other ideas?

StChat’s picture

I have found out that chart_size is actually the same with the array(). You can try (440,220) that works for me but greater values do not. Someone enlighten us...

13rac1’s picture

Can you post the generated API URL?

pwhite’s picture

//chart.googleapis.com/chart?chd=t%3A10%2C50%2C100&cht=t&chs=440x220&chtt=5616&chco=ffffff%2Cedf0d4%2C13390a&chf=&chld=MGKETN&chtm=africa

13rac1’s picture

The above chart is working, but there are image size limitations. See: https://developers.google.com/chart/image/docs/chart_params#gcharts_chs

Width x height cannot exceed 300,000.

Pierre.Vriens’s picture

Title: Creating a Map in Drupal 7 » Create a Map only shows title
Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)
Parent issue: » #2369883: Create chart documentation

Not sure what the current status of this issue is. Can anyone update the issue accordingly please? If not I suggest to consider it closed (fixed).

Pierre.Vriens’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

About 1 week later no feedback received. Therefor I'm updating this issue. Feel free to reopen if needed.