Ero sivun ”Widget:JwObsCharts” versioiden välillä
Järvi-meriwikistä
Rivi 67: | Rivi 67: | ||
memo.height = memo.widgetEl.attr( 'data-height' ); if (typeof memo.height == 'undefined') { memo.height = 450; } | memo.height = memo.widgetEl.attr( 'data-height' ); if (typeof memo.height == 'undefined') { memo.height = 450; } | ||
− | memo.siteid = jQuery( this ).attr( 'data-jw-siteid' ); | + | memo.siteid = jQuery( this ).attr( 'data-jw-siteid' ); if ( typeof memo.siteid == 'undefined' ) { memo.siteid = '-'; } |
− | memo.obscode = jQuery( this ).attr( 'data-jw-obscode' ); | + | memo.body = jQuery( this ).attr( 'data-jw-body' ); if ( typeof memo.body == 'undefined' ) { memo.body = '-'; } |
+ | memo.obscode = jQuery( this ).attr( 'data-jw-obscode' ); if ( typeof memo.obscode == 'undefined' ) { memo.obscode = '-'; } | ||
memo.refcode = jQuery( this ).attr( 'data-jw-refcode' ); if ( typeof memo.refcode == 'undefined' ) { memo.refcode = '-'; } | memo.refcode = jQuery( this ).attr( 'data-jw-refcode' ); if ( typeof memo.refcode == 'undefined' ) { memo.refcode = '-'; } | ||
memo.reffilter = jQuery( this ).attr( 'data-jw-reffilter' ); if ( typeof memo.reffilter == 'undefined' ) { memo.reffilter = ''; } | memo.reffilter = jQuery( this ).attr( 'data-jw-reffilter' ); if ( typeof memo.reffilter == 'undefined' ) { memo.reffilter = ''; } | ||
Rivi 327: | Rivi 328: | ||
} | } | ||
− | memo.jw.loadObses( { 'obscode': memo.obscodeParts[0], 'siteid': memo.siteid, 'startdate': memo.startDate, 'custom': custom }, function( o ) { | + | memo.jw.loadObses( { 'obscode': memo.obscodeParts[0], 'siteid': memo.siteid, 'startdate': memo.startDate, 'custom': custom }, function( o ) { |
− | |||
memo.obses = memo.jw.obs; | memo.obses = memo.jw.obs; | ||
− | if ( memo.refcode != '-' ) { | + | if ( memo.refcode != '-' && memo.siteid != '-' ) { |
memo.jwR.loadObses( { "obscode": memo.refcode, "siteid": memo.siteid, "sort": "SiteID", "custom": memo.reffilter }, function( r ) { | memo.jwR.loadObses( { "obscode": memo.refcode, "siteid": memo.siteid, "sort": "SiteID", "custom": memo.reffilter }, function( r ) { | ||
− | memo.refs = memo.jwR.obs; | + | memo.refs = memo.jwR.obs; |
− | |||
drawVisualization(memo); | drawVisualization(memo); | ||
}); | }); | ||
+ | } else if ( memo.refcode != '-' && memo.basin != '-' ) { | ||
+ | memo.jwR.loadObses( { "obscode": memo.refcode, "basin": memo.basin, "custom": memo.reffilter }, function( r ) { | ||
+ | memo.refs = memo.jwR.obs; | ||
+ | drawVisualization(memo); | ||
+ | }); | ||
} else { | } else { | ||
drawVisualization(memo); | drawVisualization(memo); |