I'm using Charts module to create some charts using the API. Depending on some variable i can create a pie chart or a column chart.
That variable is chart_type:
$chart_type = 'column'; $chart_type = 'pie';
This is the code I have:
$chart = array( '#type' => 'chart', '#title' => 'title', '#chart_type' => $chart_type, '#chart_library' => 'google', '#legend' => FALSE, '#tooltips' => TRUE, '#height' => 234, '#colors' => array('#006400', '#c11d0b'), ); $chart['Status'] = array( '#type' => 'chart_data', '#title' => 'title', '#data' => array(500, 100), '#show_in_legend' => FALSE, '#show_labels' => FALSE, ); $chart['xaxis'] = array( '#type' => 'chart_xaxis', '#labels' => array('Good', 'Bad'), ); $my_chart['chart'] = $chart; return drupal_render($my_chart);
When the chart is of type Pie, I can see the two colors (green and red) correctly assigned to the slices of the pie. However, I can't assign the same principle to the column chart - in this case, both bars are green.
What I need is to have the colunn chart with the first bar green and the second one, red.
EDIT: Also, on the pie chart, I get two circles and I want to get rid of them. I thought it was a legend but it's not so... how can I remove them also?