Ero sivun ”Widget:JwObsCharts” versioiden välillä
Järvi-meriwikistä
Rivi 56: | Rivi 56: | ||
memo.obscode = jQuery( this ).attr( 'data-jw-obscode' ); | memo.obscode = jQuery( this ).attr( 'data-jw-obscode' ); | ||
memo.obscodeParts = memo.obscode.split('_'); | memo.obscodeParts = memo.obscode.split('_'); | ||
− | memo.title = jQuery( this ).attr( 'data-title' ); if ( typeof memo.title == 'undefined' ) { memo.title = i18n[ memo.obscode ][ 'title' ][ memo.lang ]; } | + | memo.title = jQuery( this ).attr( 'data-title' ); if ( typeof memo.title == 'undefined' ) { memo.title = i18n[ memo.obscode ][ 'title' ][ memo.lang ]; } |
− | memo. | + | memo.startDate = jQuery( this ).attr( 'data-start-date' ); |
+ | if ( typeof memo.startDate == 'undefined' ) && ( typeof jQuery( this ).attr( 'data-start-year' ) != 'undefined' ) { | ||
+ | memo.startDate = jQuery( this ).attr( 'data-start-year' ) + '-01-01'; | ||
+ | } else { | ||
+ | memo.startDate = '1800-01-01'; | ||
+ | } | ||
memo.service = jQuery( this ).attr( 'data-coo311-service_code' ); | memo.service = jQuery( this ).attr( 'data-coo311-service_code' ); | ||
memo.graphType = jQuery( this ).attr( 'data-graph-type' ); | memo.graphType = jQuery( this ).attr( 'data-graph-type' ); | ||
− | if ( typeof jQuery( this ).attr( 'data-current-period' ) == 'undefined' ) { memo.currentPeriod = '-'; } | + | //if ( typeof jQuery( this ).attr( 'data-current-period' ) == 'undefined' ) { memo.currentPeriod = '-'; } |
− | else { memo.currentPeriod = jQuery( this ).attr( 'data-current-period' ); } | + | //else { memo.currentPeriod = jQuery( this ).attr( 'data-current-period' ); } |
memo.editUrl = jQuery( this ).attr( 'data-edit-url' ); if (typeof memo.editUrl == 'undefined') { memo.editUrl = '-'; } | memo.editUrl = jQuery( this ).attr( 'data-edit-url' ); if (typeof memo.editUrl == 'undefined') { memo.editUrl = '-'; } | ||
memo.csvfile = jQuery( this ).attr( 'data-csv-filename' ); if (typeof memo.csvfile == 'undefined') { memo.csvfile = i18n[ memo.obscode ].title[ memo.lang ] + '_SiteID-' + memo.siteid + '_Downloaded-' + today.toISOString().split( 'T' )[0] + '.csv'; } | memo.csvfile = jQuery( this ).attr( 'data-csv-filename' ); if (typeof memo.csvfile == 'undefined') { memo.csvfile = i18n[ memo.obscode ].title[ memo.lang ] + '_SiteID-' + memo.siteid + '_Downloaded-' + today.toISOString().split( 'T' )[0] + '.csv'; } | ||
Rivi 301: | Rivi 306: | ||
} | } | ||
} | } | ||
− | + | ||
− | memo.jw.loadObses( { 'obscode': memo.obscodeParts[0], 'siteid': memo.siteid, 'startdate': memo. | + | 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.comparecode ) { | //if ( memo.comparecode ) { | ||
Rivi 311: | Rivi 316: | ||
// drawVisualization(memo); | // drawVisualization(memo); | ||
//} | //} | ||
− | console.log( memo.obses ); | + | //console.log( memo.obses ); |
drawVisualization(memo); | drawVisualization(memo); | ||
}); | }); |