There is difference between NULL and 'NULL' values. Why is used placeholder 'NULL' on the row 366 in chart.module?
if ($v != 'NULL'){

If this module is used as API, it would be usefull naturaly represent no graph data points with NULL and then with -1

CommentFileSizeAuthor
#2 Chart tester.png13.82 KBVote_Sizing_Steve

Comments

tjholowaychuk’s picture

Assigned: Unassigned » tjholowaychuk
Priority: Normal » Minor
Status: Active » Postponed

Im aware of this, to be honest I do not remember why I chose to go with a string. Certainly not a big issue and I would agree that this could most likely be changed.

Vote_Sizing_Steve’s picture

StatusFileSize
new13.82 KB

I'm wrestling with what might be this issue. If I use the sample on the google wiki page http://code.google.com/p/drupal-chart-api/wiki/Examples, but lower the y values of some points to 0:

$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, 0, 5, 4, 2);
  $chart['#data']['meats']  = array(2, 2, 4, 3, 1);
  $chart['#data']['dairy']  = array(5, 2, 3, 1, 0);

  $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);

... the connecting lines disappear (see attachment). Is there a setting somewhere I've set wrong, or is this a bug?

tjholowaychuk’s picture

I cannot confirm at the moment, but I believe that was how google renders the nil values. Will have to take a look

Vote_Sizing_Steve’s picture

Here's the work-around I wrote, which seems to work:

function Google_Chart_x( $y =0, $Max_y =0 ){
  return(
    ( 98 * $y / $Max_y ) + 1 ) ; }
sivaji_ganesh_jojodae’s picture

there is a bug in char module code, whenever the $chart['#data']['fruits'][$i] = 0 value -1 is returned.

it works after applying this patch http://drupal.org/files/issues/chart.module.patch

toemaz’s picture

Status: Postponed » Needs review

Patch applied and it worked for me. Thx.

boombatower’s picture

Status: Needs review » Closed (won't fix)

5.x is no longer supported..seems to work in 6.x and 7.x.