Bar graph php error

After updating to the latest master I have the following php error displayed above all bar graph charts.  This happens on both dashboards and when viewing a bar graph through the visualizations menu.

Notice: Undefined index: colour in/var/www/emoncms/Modules/vis/vis_controller.php on line 111

Any ideas as to why?  Nothing else has changed as far as I'm aware.

Thanks.

jesjimher's picture

Re: Bar graph php error

Color options are not handled well in that portion of code. I've rewritten these lines like this:

...
else if ($type==9) {
  # we need to either urlescape the colour, or just scrub out invalid chars. I'm doing the second, since
  # we can be fairly confident that colours are eiter a hex or a simple word (e.g. "blue" or such)
  $array[$key]=get($key);
  if (preg_match('/^colour/',$key))
    $array[$key] = preg_replace('/[^\dA-Za-z]/','',$array[$key]); 
}
...

Type 9 options (colours) weren't included inside $array (with get($key)), and I've also replaced a direct "==" comparison with a preg_match call, so options with "colour" as a prefix instead of full name are processed too. I'm not really sure why it hasn't failed since today (this code is quite a few months old), but anyway I've committed this changes to my fork and everything is working fine, so if nobody has fixed it yet tomorrow morning, I'll send a pull request to emoncms main repository.

[Formatting fixed]

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.