有一篇很好用的文章:http://www.lullabot.com/articles/drupal-charting。详细的介绍了各个Drupal的图表模块,很具有参考价值。
一周起始日期
|
Charts
|
Chart
|
FusionCharts
|
2009-12-20
|
1,120
|
1,395
|
295
|
2009-12-13
|
1,140
|
1,474
|
253
|
2009-12-6
|
1,110
|
1,399
|
265
|
平均
|
1,123
|
1423
|
271
|

$chart = '#chart_id' '#title' '#type' ); $chart[ $chart[ $chart[ echo chart_render($chart);'#data']['dairy'] =5;'#data']['meats'] =2;'#data']['fruits']=3;=> CHART_TYPE_PIE_3D,=> t('Servings'),=>'test_chart', array(
$chart = '#chart_id' '#title' '#type' '#size' ); $chart[ $chart[ $chart[ $chart[ $chart[ $chart[ echo chart_render($chart);'#labels'][]= t('Dairy');'#labels'][]= t('Meats');'#labels'][]= t('Fruits');'#data']['dairy'] =5;'#data']['meats'] =2;'#data']['fruits']=3;=> chart_size(400,200),=> CHART_TYPE_PIE,=> chart_title(t('Servings'),'cc0000',15),=>'test_chart', array(
替代方式之一,可以使用颜色模式钩子chart_unique_color()。,它可以关联到多个包含部分或全部相同内容的图表。你也可以考虑一下

$chart = '#chart_id' '#title' '#type' '#size' ); $chart[ $chart[ $chart[ $chart[ $chart[ $chart[ $chart[ $chart[ $chart[ echo chart_render($chart);'#data_colors'][]='0000ff';'#data_colors'][]='ff0000';'#data_colors'][]='00ff00';'#labels'][]= t('Dairy');'#labels'][]= t('Meats');'#labels'][]= t('Fruits');'#data']['dairy'] =5;'#data']['meats'] =2;'#data']['fruits']=3;=> chart_size(400,200),=> CHART_TYPE_PIE,=> chart_title(t('Servings'),'cc0000',15),=>'test_chart', array(


'#chart_id'=>'test_chart',
'#title'=> chart_title(t('Servings'),'cc0000',15),
'#type'=> CHART_TYPE_LINE,
'#size'=> chart_size(400,200),
'#adjust_resolution'=> TRUE,
);
$chart['#data']['fruits']= array(1,3,5,4,2);
$chart['#data']['meats'] = array(2,2,4,3,1);
$chart['#data']['dairy'] = array(5,2,3,1,2);
$chart['#legends'][]= t('Fruits');
$chart['#legends'][]= t('Meats');
$chart['#legends'][]= t('Dairy');
$chart['#data_colors'][]='00ff00';
$chart['#data_colors'][]='ff0000';
$chart['#data_colors'][]='0000ff';
$chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][0][]= chart_mixed_axis_range_label(0,5);
$chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][1][]= chart_mixed_axis_label(t('Count'),95);
$chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][]= chart_mixed_axis_label(t('Mon'));
$chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][]= chart_mixed_axis_label(t('Tue'));
$chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][]= chart_mixed_axis_label(t('Wed'));
$chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][]= chart_mixed_axis_label(t('Thu'));
$chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][]= chart_mixed_axis_label(t('Fri'));
$chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][2][]= chart_mixed_axis_label(t('Days of the week'),50);
echo chart_render($chart);

'#chart_id'=>'test_chart',
'#title'=> chart_title(t('Servings'),'cc0000',15),
'#type'=> CHART_TYPE_LINE,
'#size'=> chart_size(400,200),
'#chart_fill'=> chart_fill('c','eeeeee'),
'#grid_lines'=> chart_grid_lines(20,20,1,5),
);
for($i =0; $i <80; $i++){
$chart['#data'][]= $i + rand(0, $i);
}
echo chart_render($chart);

'#chart_id'=>'test_chart',
'#title'=> chart_title(t('Bar Chart'),'0000ee',15),
'#type'=> CHART_TYPE_BAR_V_GROUPED,
'#size'=> chart_size(400,200),
'#grid_lines'=> chart_grid_lines(30,15),
'#bar_size'=> chart_bar_size(15,5),
);
$chart['#data'][]= array(40,50,70);
$chart['#data'][]= array(60,50,30);
$chart['#data'][]= array(40,60,20);
$chart['#data_colors'][]= chart_unique_color('test_a');
$chart['#data_colors'][]= chart_unique_color('test_b');
$chart['#data_colors'][]= chart_unique_color('test_c');
echo chart_render($chart);

$chart = array(
'#chart_id'=>'test_chart',
'#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)
);
echo chart_render($chart);
?>
