How to define label color
fora - April 21, 2009 - 08:33
| Project: | Chart API |
| Version: | 6.x-1.2 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Is it possible to define color for labels. I don't want that dark gray.
I want that my labels (for 3d pie graf) are dark green or red?
Is it possible to do that?

#1
A fellow posted a comment at the bottom of this page using a scatter chart with green / red labels, might want to check out his code
http://code.google.com/p/drupal-chart-api/wiki/Examples
#2
A little more followup to tjholowaychuk. It looks like you can style labels for only certain types of charts such as line, bar, radar, and scatter charts. You can check out more info from the google chart api: http://code.google.com/apis/chart/labels.html#axis_styles_labels
The code sample below (taken from - http://snippets.dzone.com/posts/show/5985) shows you how to use '#mixed_axis_labels' to pass through styling parameters:
$chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][0][] = chart_mixed_axis_range_label(0, $sqlcnt + 1);
$chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(t(' '));
$chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(t('members'));
$chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(t(' '));
$chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][2][] = chart_mixed_axis_range_label(0, 1000);
$chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][3][] = chart_mixed_axis_label(t(' '));
$chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][3][] = chart_mixed_axis_label(t('flyDollars'));
$chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][3][] = chart_mixed_axis_label(t(' '));
//label colors
$chart['#mixed_axis_label_styles'][] = array(0,'000000',10);
$chart['#mixed_axis_label_styles'][] = array(1,'000000',10);
$chart['#mixed_axis_label_styles'][] = array(2,'0000ff',15);
$chart['#mixed_axis_label_styles'][] = array(3,'00ff00',15);