I would like to make 100% width , but Flot module throws an error message.

Example:

$variables = array(
    'data' => array($d1, $d2),
    'element' => array(
      'id' => 'flot-example-normal',
      'class' => 'flot-example',
      'style' => "width:100%; height:300px",
    ),
    'legend' => TRUE,
    'zoom' => TRUE,
  );

I get: Notice: Undefined offset: 1 in template_preprocess_flot_graph() (line 173 of ... all/modules/contrib/flot/flot.module).

I would recommend to refine the regex and remove px.

preg_match('/width:(.*)px;/', $variables['element']['graph']['style'], $width);

to this:

preg_match('/width:(.*);/', $variables['element']['graph']['style'], $width);
CommentFileSizeAuthor
#3 flot-undefined_offset-1929906.patch722 bytesorange-wedge

Comments

attiks’s picture

@minnur can you provide a patch?

orange-wedge’s picture

Issue summary: View changes

The error is this:

Notice: Undefined offset: 1 in template_preprocess_flot_graph()

The fix recommended is partially correct. You would need to change the $zoom_element array too:

    preg_match('/width:(.*);/', $variables['element']['graph']['style'], $width);
    $zoom_element = array(
      'id' => $variables['element']['graph']['id'] . '-zoom',
      'style' => 'width:' . $width[1] . ';height:100px',
      'class' => array('flot-zoom'),
    );

orange-wedge’s picture

StatusFileSize
new722 bytes
beakerboy’s picture

Status: Active » Closed (won't fix)