When chart labels are long (or there are several different labels), they often times are truncated as if they go off the edge of the image. One work-around for this is to add margins to your chart URI like so: &chma=50,50,50,50.

I thought it would be great if you could add margins to a chart URL like this:

    $my_chart['awesome_chart'] = array('#chart_id' => 'awesome_chart',
                                                       '#title' => t('What a great chart'),
                                                       '#type' => CHART_TYPE_PIE_3D,
                                                       '#size' => chart_size(500, 300),
                                                       '#margins' => '50, 50, 50, 50',
                                                       );

I patched the chart.module to allow for this. Patch attachment forthcoming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

axlroach’s picture

FileSize
0 bytes

Here's the patch file:

axlroach’s picture

FileSize
1.15 KB

Whoops. Here's a patch file that actually has data in it:

solemanus’s picture

This patch produces a Hunk error at line 274.

13rac1’s picture

Version: 6.x-1.2 » 6.x-1.x-dev
Assigned: axlroach » Unassigned
Status: Needs review » Patch (to be ported)
FileSize
2.45 KB

Functionality and support function chart_margins() committed to 7.x-1.x. Patch needs to be ported to 6.x-1.x.

13rac1’s picture

Status: Patch (to be ported) » Fixed

Manually applied to 6.x-1.x-dev.

Status: Fixed » Closed (fixed)

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