How to conditionally specify a variable in yocto .bb recipe - yocto

I would like to do something like this:
if [ "${BB_NO_NETWORK}" == "1" ]; then
SRCREV ?= "a2d1f0225692c7c054014ec4dfc4dd13a35245ee"
else
SRCREV ?= "${AUTOREV}"
fi
But I get an unparsed error
Here is what I have got working.
SRCREV_FORMAT = "${#bb.utils.contains('BB_NO_NETWORK', '1', "v16_pcmx", "${AUTOREV}", d)}"
SRCREV_d3v16 = "${#bb.utils.contains('BB_NO_NETWORK', '1', "a2d1f0225692c7c054014ec4dfc4dd13a35245ee", "${AUTOREV}", d)}"
SRCREV_v16 = "${#bb.utils.contains('BB_NO_NETWORK', '1', "a2d1f0225692c7c054014ec4dfc4dd13a35245ee", "${AUTOREV}", d)}"
SRCREV_pcmx-native = "${#bb.utils.contains('BB_NO_NETWORK', '1', "d09e0b91ae34d807d3df27908f045e58a52e0c4c", "${AUTOREV}", d)}"
SRCREV_pcmx-pn-pcmx = "${#bb.utils.contains('BB_NO_NETWORK', '1', "d09e0b91ae34d807d3df27908f045e58a52e0c4c", "${AUTOREV}", d)}"
SRCREV_pcmx = "${#bb.utils.contains('BB_NO_NETWORK', '1', "d09e0b91ae34d807d3df27908f045e58a52e0c4c", "${AUTOREV}", d)}"
SRCREV_pn-pcmx = "${#bb.utils.contains('BB_NO_NETWORK', '1', "d09e0b91ae34d807d3df27908f045e58a52e0c4c", "${AUTOREV}", d)}"
SRCREV = "${#bb.utils.contains('BB_NO_NETWORK', '1', "", "${AUTOREV}", d)}"
This attempt fails:
SRCREV_FORMAT = "${# "v16_pcmx" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK',TRUE)) else d.getVar('AUTOREV') }"
SRCREV_d3v16 = "${# "a2d1f0225692c7c054014ec4dfc4dd13a35245ee" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK',TRUE)) else d.getVar('AUTOREV') }"
SRCREV_v16 = "${# "a2d1f0225692c7c054014ec4dfc4dd13a35245ee" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK',TRUE)) else d.getVar('AUTOREV') }"
SRCREV_pcmx-native = "${# "d09e0b91ae34d807d3df27908f045e58a52e0c4c" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK',TRUE)) else d.getVar('AUTOREV') }"
SRCREV_pcmx-pn-pcmx = "${# "d09e0b91ae34d807d3df27908f045e58a52e0c4c" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK',TRUE)) else d.getVar('AUTOREV') }"
SRCREV_pcmx = "${# "d09e0b91ae34d807d3df27908f045e58a52e0c4c" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK',TRUE)) else d.getVar('AUTOREV') }"
SRCREV_pn-pcmx = "${# "d09e0b91ae34d807d3df27908f045e58a52e0c4c" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK',TRUE)) else d.getVar('AUTOREV') }"
SRCREV = "${# "" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK',TRUE)) else d.getVar('AUTOREV') }"
This also fails
SRCREV_FORMAT = "${# "v16_pcmx" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')) else d.getVar('AUTOREV') }"
SRCREV_d3v16 = "${# "a2d1f0225692c7c054014ec4dfc4dd13a35245ee" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')) else d.getVar('AUTOREV') }"
SRCREV_v16 = "${# "a2d1f0225692c7c054014ec4dfc4dd13a35245ee" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')) else d.getVar('AUTOREV') }"
SRCREV_pcmx-native = "${# "d09e0b91ae34d807d3df27908f045e58a52e0c4c" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')) else d.getVar('AUTOREV') }"
SRCREV_pcmx-pn-pcmx = "${# "d09e0b91ae34d807d3df27908f045e58a52e0c4c" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')) else d.getVar('AUTOREV') }"
SRCREV_pcmx = "${# "d09e0b91ae34d807d3df27908f045e58a52e0c4c" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')) else d.getVar('AUTOREV') }"
SRCREV_pn-pcmx = "${# "d09e0b91ae34d807d3df27908f045e58a52e0c4c" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')) else d.getVar('AUTOREV') }"
SRCREV = "${# "" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')) else d.getVar('AUTOREV') }"
The error for this one looks like this:
bb.data_smart.ExpansionError: Failure expanding variable SRCREV_v16, expression was ${# "a2d1f0225692c7c054014ec4dfc4dd13a35245ee" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')) else d.getVar('AUTOREV') } which triggered exception TypeError: getVar() missing 1 required positional argument: 'expand'
Lastly, this fails as well:
SRCREV_FORMAT = "${#'v16_pcmx' if d.getVar('BB_NO_NETWORK') == '1' else '${AUTOREV}'}"
SRCREV_d3v16 = "${#'a2d1f0225692c7c054014ec4dfc4dd13a35245ee' if d.getVar('BB_NO_NETWORK') == '1' else '${AUTOREV}'}"
SRCREV_v16 = "${#'a2d1f0225692c7c054014ec4dfc4dd13a35245ee' if d.getVar('BB_NO_NETWORK') == '1' else '${AUTOREV}'}"
SRCREV_pcmx-native = "${#'d09e0b91ae34d807d3df27908f045e58a52e0c4c' if d.getVar('BB_NO_NETWORK') == '1' else '${AUTOREV}'}"
SRCREV_pcmx-pn-pcmx = "${#'d09e0b91ae34d807d3df27908f045e58a52e0c4c' if d.getVar('BB_NO_NETWORK') == '1' else '${AUTOREV}'}"
SRCREV_pcmx = "${#'d09e0b91ae34d807d3df27908f045e58a52e0c4c' if d.getVar('BB_NO_NETWORK') == '1' else '${AUTOREV}'}"
SRCREV_pn-pcmx = "${#'d09e0b91ae34d807d3df27908f045e58a52e0c4c' if d.getVar('BB_NO_NETWORK') == '1' else '${AUTOREV}'}"
SRCREV = "${#'' if d.getVar('BB_NO_NETWORK') == '1' else '${AUTOREV}'}"

I guess on modern OE it's gonna look like this (untested):
SRCREV = "${# "a2d1f0225692c7c054014ec4dfc4dd13a35245ee" if bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')) else d.getVar('AUTOREV') }"
using inline python variable expansion. On older OE you might need to specify second parameter to d.getVar, like d.getVar('BB_NO_NETWORK', True).

You can also use base_conditional from utils.bbclass:
SRCREV = "${#base_conditional('BB_NO_NETWORK', '1', 'a2d1f0225692c7c054014ec4dfc4dd13a35245ee', '${AUTOREV}', d)}"

Related

Why imagecreatefromjpeg not working for .jpg extension?

I have code for thumbnails which works great for gif, png and jpeg files but not for jpg.
Please help me how to make it work for jpg.
I get no errors and nothing in log file.
function create_thumb($src,$dest,$desired_width = false, $desired_height = false){
if (!$desired_height&&!$desired_width) return false;
$fparts = pathinfo($src);
$ext = strtolower($fparts['extension']);
if (!in_array($ext,array('gif','jpg','png','jpeg'))) return false;
if ($ext == 'gif') $resource = imagecreatefromgif($src);
else if ($ext == 'png') $resource = imagecreatefrompng($src);
else if ($ext == 'jpg' || $ext == 'jpeg') $resource = imagecreatefromjpeg($src);
$width = imagesx($resource);
$height = imagesy($resource);
if(!$desired_height) $desired_height = floor($height*($desired_width/$width));
if(!$desired_width) $desired_width = floor($width*($desired_height/$height));
$virtual_image = imagecreatetruecolor($desired_width,$desired_height);
imagecopyresized($virtual_image,$resource,0,0,0,0,$desired_width,$desired_height,$width,$height);
$fparts = pathinfo($dest);
$ext = strtolower($fparts['extension']);
if (!in_array($ext,array('gif','jpg','png','jpeg')))
$ext = 'jpg';$dest = $fparts['dirname'].'/'.$fparts['filename'].'.'.$ext;
if ($ext == 'gif') imagegif($virtual_image,$dest);
else if ($ext == 'png') imagepng($virtual_image,$dest,1);
else if ($ext == 'jpg' || $ext == 'jpeg') imagejpeg($virtual_image,$dest,72);
return array( 'width' => $width, 'height' => $height, 'new_width' => $desired_width, 'new_height'=> $desired_height, 'dest' => $dest ); }
I find solution for me...
$dest = $fparts['dirname'].'/'.$fparts['filename'].'.gif';
imagewebp($virtual_image,$dest,80);
Every image is gif and very small size ;)
Hope it will help to somebody.

Add several records in moodle

I've been having trouble adding items in my table in moodle, this is what I've trying with no success.
$totalrec = array();
$rec2 = $DB->get_records('table1', null, '', '*', 0, 0);
$rec4 = $DB->get_records('table2', array('x' => 'y') , '', '*', 0, 0);
foreach ($rec2 as $records2) {
$rec3 = $DB->get_records('z', array('m' => 'n') , '', '*', 0, 0);
foreach ($rec3 as $records3) {
if (isset($_REQUEST['a']) && isset($_REQUEST['b'])) {
$ca = $_REQUEST['a'];
$co = $_REQUEST['b'];
$pi = $records2->idp;
$recorsh = new class ();
$recorsh->id = $records2->id;
$recorsh->te = $co;
$recorsh->idt = $ti;
$recorsh->res = $ca;
$recorsh->ida = $idaud;
$totalrec[$n] = array($recorsh);
$n++;
}
}
}
$lastinsertid2 = $DB->insert_records('table4', $totalrec);
and, this one:
$rec2 = $DB->get_records('table1', null, '', '*', 0, 0);
$rec4 = $DB->get_records('table2', array('x' => 'y') , '', '*', 0, 0);
foreach($rec2 as $records2) {
$rec3 = $DB->get_records('z', array('m' => 'n') , '', '*', 0, 0);
foreach($rec3 as $records3) {
if (isset($_REQUEST['a']) && isset($_REQUEST['b'])) {
$ca = $_REQUEST['a'];
$co = $_REQUEST['b'];
$pi = $records2->idp;
$recorsh = new class ();
$recorsh->id = $records2->id;
$recorsh->te = $co;
$recorsh->idt = $ti;
$recorsh->res = $ca;
$recorsh->ida = $idaud;
$lastinsertid = $DB->insert_record('table4', $recorsh, false);
}
}
}
Both of them gives me a "Error writing to database" but doesn't say anything specific, I know that I'm not doing the inserting "in the right way" but I don't know how to do it, what am I doing wrong?
It's probably because the ID is added to each object before inserting.
$recorsh->id = $records2->id;
Like davosmith says, during development always have debugging set to developer level.
In your config.php have this
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 0);
$CFG->debug = E_ALL | E_STRICT; // 32767;
$CFG->debugdisplay = true;
Also never ever use $_REQUEST or $_GET or $_POST directly. This can introduce SQL injection.
Use
$a = optional_param('a', null, PARAM_XXX);
$b = optional_param('b', null, PARAM_XXX);
or
$a = required_param('a', PARAM_XXX);
$b = required_param('b', PARAM_XXX);
Change PARAM_XXX to the type of parameter you are expecting. eg PARAM_INT, PARAM_BOOL etc.

PHP preg_replace_callback replace wrong open and end tags

I'm having a problem with my BB-Code function. I've tested followig input to replace:
Testtext! <b>text<u>testtext</u>test</b><b>test</b>
and get this (mixed) output:
Testtext! [b]text[u]testtext[/u]test</b>test<b>test[/b]
my PHP-Code:
function html_to_bbcode($input) {
$regex[] = '#\<b>((?:[^[]|\<(?!/?b>)|(?R))+)\</b>#im';
$regex[] = '#\<i>((?:[^[]|\<(?!/?i>)|(?R))+)\</i>#im';
$regex[] = '#\<u>((?:[^[]|\<(?!/?u>)|(?R))+)\</u>#im';
if (is_array($input)) {
$tag = explode('>', $input[0]);
$tag = str_replace('<', '', $tag[0]);
if ($tag == 'b') {
$input = '[b]'.$input[1].'[/b]';
} else if ($tag == 'i') {
$input = '[i]'.$input[1].'[/i]';
} else if ($tag == 'u') {
$input = '[u]'.$input[1].'[/u]';
}
}
return preg_replace_callback($regex, 'html_to_bbcode', $input);
}
(and some more Tags)
I can't find that bug :( Have anyone an solution for this?

Modify code to auto complete on taxonomies instead of title

I've been trying for hours to modify this plugin to work with custom taxonomies instead of post titles and/or post content
http://wordpress.org/extend/plugins/kau-boys-autocompleter/
Added the code / part of the plugin where I think the modification should be done. I could post some stuff I tried but I think it would just confuse people, I don't think I ever came close. Normally I can modify code perfectly but just can't seem to find it. I've tried this method posted here.
http://wordpress.org/support/topic/autocomplete-taxonomy-in-stead-of-title-or-content
But it doesn't work. I've tried searching for possible solutions around his suggestion but I'm starting to think his suggestion isn't even close to fixing it.
if(WP_DEBUG){
error_reporting(E_ALL);
} else {
error_reporting(0);
}
header('Content-Type: text/html; charset=utf-8');
// remove the filter functions from relevanssi
if(function_exists('relevanssi_kill')) remove_filter('posts_where', 'relevanssi_kill');
if(function_exists('relevanssi_query')) remove_filter('the_posts', 'relevanssi_query');
if(function_exists('relevanssi_kill')) remove_filter('post_limits', 'relevanssi_getLimit');
$choices = get_option('kau-boys_autocompleter_choices');
$framework = get_option('kau-boys_autocompleter_framework');
$encoding = get_option('kau-boys_autocompleter_encoding');
$searchfields = get_option('kau-boys_autocompleter_searchfields');
$resultfields = get_option('kau-boys_autocompleter_resultfields');
$titlelength = get_option('kau-boys_autocompleter_titlelength');
$contentlength = get_option('kau-boys_autocompleter_contentlength');
if(empty($choices)) $choices = 10;
if(empty($framework)) $framework = 'jQuery';
if(empty($encoding)) $encoding = 'UTF-8';
if(empty($searchfields)) $searchfields = 'both';
if(empty($resultfields)) $resultfields = 'both';
if(empty($titlelength)) $titlelength = 50;
if(empty($contentlength)) $contentlength = 120;
mb_internal_encoding($encoding);
mb_regex_encoding($encoding);
$words = '%'.$_REQUEST['q'].'%';
switch($searchfields){
case 'post_title' :
$where = 'post_title LIKE "'.$words.'"';
break;
case 'post_content' :
$where = 'post_content LIKE "'.$words.'"';
default :
$where = 'post_title LIKE "'.$words.'" OR post_content LIKE "'.$words.'"';
}
$wp_query = new WP_Query();
$wp_query->query(array(
's' => $_REQUEST['q'],
'showposts' => $choices,
'post_status' => 'publish'
));
$posts = $wp_query->posts;
$results = array();
foreach ($posts as $key => $post){
setup_postdata($post);
$title = strip_tags(html_entity_decode(get_the_title($post->ID), ENT_NOQUOTES, 'UTF-8'));
$content = strip_tags(strip_shortcodes(html_entity_decode(get_the_content($post->ID), ENT_NOQUOTES, 'UTF-8')));
if(mb_strpos(mb_strtolower(($searchfields == 'post_title')? $title : (($searchfields == 'post_content')? $content : $title.$content)), mb_strtolower($_REQUEST['q'])) !== false){
$results[] = array(
'url' => get_permalink($post->ID),
'title' => highlightSearchString(strtruncate($title, $titlelength, true), $_REQUEST['q']),
'content' => (($resultfields == 'both')? highlightSearchString(strtruncate($content, $contentlength, false, '[...]', $_REQUEST['q']), $_REQUEST['q']) : '')
);
}
}
printResults($results, $framework);
function highlightSearchString($value, $searchString){
if((version_compare(phpversion(), '5.0') < 0) && (strtolower(mb_internal_encoding()) == 'utf-8')){
$value = utf8_encode(html_entity_decode(utf8_decode($value)));
}
$regex_chars = '\.+?(){}[]^$';
for ($i=0; $i<mb_strlen($regex_chars); $i++) {
$char = mb_substr($regex_chars, $i, 1);
$searchString = str_replace($char, '\\'.$char, $searchString);
}
$searchString = '(.*)('.$searchString.')(.*)';
return mb_eregi_replace($searchString, '\1<span class="ac_match">\2</span>\3', $value);
}
function strtruncate($str, $length = 50, $cutWord = false, $suffix = '...', $needle = ''){
$str = trim($str);
if((version_compare(phpversion(), '5.0') < 0) && (strtolower(mb_internal_encoding()) == 'utf-8')){
$str = utf8_encode(html_entity_decode(utf8_decode($str)));
}else{
$str = html_entity_decode($str, ENT_NOQUOTES, mb_internal_encoding());
}
if(mb_strlen($str)>$length){
if(!empty($needle) && mb_strpos(mb_strtolower($str), mb_strtolower($needle)) > 0){
$pos = mb_strpos(mb_strtolower($str), mb_strtolower($needle)) + (mb_strlen($needle) / 2);
$startToShort = ($pos - ($length / 2)) < 0;
$endToShort = ($pos + ($length / 2)) > mb_strlen($str);
// build the prefix and suffix
$prefix = $suffix;
if($startToShort){
$prefix = '';
}
if($endToShort){
$suffix = '';
}
// set maximum length
$length = $length - mb_strlen($prefix) - mb_strlen($suffix);
// get the start
if($startToShort){
$start = 0;
} elseif($endToShort){
$start = mb_strlen($str) - $length;
} else {
$start = $pos - ($length / 2);
}
// shorten the string
$string = mb_substr($str, $start, $length);
if($cutWord){
return $prefix.$string.$suffix;
} else {
$firstWhitespace = ($startToShort)? 0 : mb_strpos($string, ' ');
$lastWhitespace =($endToShort)? mb_strlen($string) : mb_strrpos($string, ' ');
return $prefix.' '.(!empty($lastWhitespace)? mb_substr($string, $firstWhitespace, ($lastWhitespace - $firstWhitespace)) : $string).' '.$suffix;
}
} else {
$string = mb_substr($str, 0, $length - mb_strlen($suffix));
return (($cutWord) ? $string : mb_substr($string, 0, mb_strrpos($string, ' ')).' ').$suffix;
}
} else {
return $str;
}
}
function printResults($results, $framework){
if($framework == 'scriptaculous'){
echo '<ul>';
foreach($results as $result){
echo ' <li>
<a href="'.$result['url'].'">
<span class="title">'.$result['title'].'</span>
<span style="display: block;">'.$result['content'].'</span>
</a>
</li>';
}
echo '</ul>';
} else {
foreach($results as $result){
echo str_replace(array("\n", "\r", '|'), array(' ',' ', '|'), '<span class="title">'.$result['title'].'</span><p>'.$result['content'].'</p>')
.'|'
.str_replace(array("\n", "\r", '|'), array(' ',' ', '|'), $result['url'])
."\n";
}
}
}

jqPlot stackSeries: true, Uncaught TypeError: Cannot read property '0' of undefined

I want to display 3 data series.
Whenever I set the stackSeries: true option in the I get the
Uncaught TypeError: Cannot read property '0' of undefined
or
Uncaught TypeError: Cannot read property '1' of undefined
when trying to display data.
When I remove the stackSeries: true attribue then the chart is rendered. What's wrong?
Update
$(document).ready(function(){
var bar1 = [
<?php
if(!empty($bar1)){
$i = 0;
foreach($bar1 as $bar){
$i++;
if(!empty($bar['jobs']['date_published'])){
if($i == count($bar1))
echo '[\''.$bar['jobs']['date_published'].'\', '.$bar[0]['count'].']';
else
echo '[\''.$bar['jobs']['date_published'].'\', '.$bar[0]['count'].'], ';
}
}
}
?>
];
var bar2 = [
<?php
if(!empty($bar2)){
$i = 0;
foreach($bar2 as $bar){
$i++;
if(!empty($bar['jobs']['date_published'])){
if($i == count($bar2))
echo '[\''.$bar['jobs']['date_published'].'\', '.$bar[0]['count'].']';
else
echo '[\''.$bar['jobs']['date_published'].'\', '.$bar[0]['count'].'], ';
}
}
}
?>
];
var bar3 = [
<?php
if(!empty($bar3)){
$i = 0;
foreach($bar3 as $bar){
$i++;
if(!empty($bar['jobs']['date_published'])){
if($i == count($bar3))
echo '[\''.$bar['jobs']['date_published'].'\', '.$bar[0]['count'].']';
else
echo '[\''.$bar['jobs']['date_published'].'\', '.$bar[0]['count'].'], ';
}
}
}
?>
];
<?php
if(!empty($bar1) && !empty($bar2) && !empty($bar3))
echo 'var labels = ["Bar 1", "Bar 2", "Bar 3"];';
else if(!empty($bar1) && !empty($bar2))
echo 'var labels = ["Bar 1", "Bar 2"];';
else if(!empty($bar2) && !empty($bar3))
echo 'var labels = ["Bar 2", "Bar 3"];';
else if(!empty($bar1) && !empty($bar3))
echo 'var labels = ["Bar 1", "Bar 3"];';
else if(!empty($bar1))
echo 'var labels = ["Bar 1"];';
else if(!empty($bar2))
echo 'var labels = ["Bar 2"];';
else if(!empty($bar3))
echo 'var labels = ["Bar 3"];';
?>
optionsObj = {
//stackSeries: true,
seriesColors:[<?php if(!empty($bar1)) echo '"#4bb2c5",';
if(!empty($bar2)) echo '"#F78181",';
if(!empty($bar3)) echo '"#9AFE2E",';
echo '"#4bb2c5"'; ?>],
animate:true,
legend:{
show:true,
location:"sw",
rowSpacing:"0px",
labels:labels
},
title:{
text:"Jobs",
fontSize:"12px"
},
seriesDefaults:{
showMarker: true,
pointLabels: { show: true },
renderer: $.jqplot.BarRenderer,
rendererOptions: {
barWidth: 2
}
},
axes:{
xaxis:{
pad:1,
tickOptions:{
fontSize:"10px"
},
renderer:$.jqplot.DateAxisRenderer
},
yaxis:{autoscale: true}
},
highlighter: {show: true},
grid:{drawGridlines:true}
};
<?php $empty = false;
if(!empty($bar1) && !empty($bar2) && !empty($bar3)){ ?>
$.jqplot('chart1', [bar1, bar2, bar3], optionsObj);
<?php } else if(!empty($bar1) && !empty($bar2)){ ?>
$.jqplot('chart1', [bar1, bar2], optionsObj);
<?php } else if(!empty($bar2) && !empty($bar3)){ ?>
$.jqplot('chart1', [bar2, bar3], optionsObj);
<?php } else if(!empty($bar1) && !empty($bar3)){ ?>
$.jqplot('chart1', [bar1, bar3], optionsObj);
<?php } else if(!empty($bar1)){ ?>
$.jqplot('chart1', [bar1], optionsObj);
<?php } else if(!empty($bar2)){ ?>
$.jqplot('chart1', [bar2], optionsObj);
<?php } else if(!empty($bar3)){ ?>
$.jqplot('chart1', [bar3], optionsObj);
<?php } ?>
});
I found that if my dataset has discontinuities in it anywhere, then a stacked graph will throw an error.
For example, this data series will throw an error:
[
[[0,22],[1,22],[2,22]],
[[0,33],[2,33]],
]
this one will not:
[
[[0,22],[1,22],[2,22]],
[[0,33],[1,33],[2,33]],
]
Note the difference between the two. The first one doesn't have a data point at X=1 for the second series. The fix would be to make sure all your series have values at all the possible X values, setting any missing ones to zero:
[
[[0,22],[1,22],[2,22]],
[[0,33],[1,0],[2,33]],
]