You are here

function theme_quiz_grade_range in Quiz 6.6

Same name and namespace in other branches
  1. 8.6 modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_grade_range()
  2. 8.4 modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_grade_range()
  3. 8.5 modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_grade_range()
  4. 6.4 includes/quiz_stats/quiz_stats.admin.inc \theme_quiz_grade_range()
  5. 7.6 modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_grade_range()
  6. 7 includes/quiz_stats/quiz_stats.admin.inc \theme_quiz_grade_range()
  7. 7.4 includes/quiz_stats/quiz_stats.admin.inc \theme_quiz_grade_range()
  8. 7.5 modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_grade_range()
  9. 6.x modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_grade_range()
1 theme call to theme_quiz_grade_range()
_get_quiz_grade_range_chart in includes/quiz_dashboard/quiz_dashboard.admin.inc

File

includes/quiz_dashboard/quiz_dashboard.admin.inc, line 258

Code

function theme_quiz_grade_range($range) {
  $chart_width = 600;
  $chart_height = 400;
  $chart = array(
    '#chart_id' => 'quiz_grade_range',
    '#title' => t('Quiz Grade Range'),
    '#type' => CHART_TYPE_BAR_V_GROUPED,
    '#size' => chart_size($chart_width, $chart_height),
    '#grid_lines' => chart_grid_lines(10, 10),
    '#bar_size' => chart_bar_size(20, 15),
    '#adjust_resolution' => TRUE,
  );

  // chart data
  $chart['#data'][][] = $range->zero_to_twenty;
  $chart['#data'][][] = $range->twenty_to_fourty;
  $chart['#data'][][] = $range->fourty_to_sixty;
  $chart['#data'][][] = $range->sixty_to_eighty;
  $chart['#data'][][] = $range->eighty_to_hundred;

  // chart color
  $chart['#data_colors'][] = chart_unique_color($range->zero_to_twenty);
  $chart['#data_colors'][] = chart_unique_color($range->twenty_to_fourty);
  $chart['#data_colors'][] = chart_unique_color($range->fourty_to_sixty);
  $chart['#data_colors'][] = chart_unique_color($range->sixty_to_eighty);
  $chart['#data_colors'][] = chart_unique_color($range->eighty_to_hundred);

  // chart x-axis label
  $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][2][] = chart_mixed_axis_label(t('Quiz Grade Range'), 50);

  // chart y-axis label and data
  $chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][1][] = chart_mixed_axis_label(t('Score'), 90);
  $chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][0][] = chart_mixed_axis_range_label(0, 10);

  // chart description on the right side
  $chart['#legends'][] = t('0 to 20 % - ') . $range->zero_to_twenty;
  $chart['#legends'][] = t('20 to 40 % - ') . $range->twenty_to_fourty;
  $chart['#legends'][] = t('40 to 60 % - ') . $range->fourty_to_sixty;
  $chart['#legends'][] = t('60 to 80 % - ') . $range->sixty_to_eighty;
  $chart['#legends'][] = t('80 to 100 % - ') . $range->eighty_to_hundred;
  return chart_render($chart);
}