Skip to content

Commit

Permalink
Re-build Rmarkdown files
Browse files Browse the repository at this point in the history
  • Loading branch information
mlap committed Feb 23, 2024
1 parent 6f41484 commit 54faf53
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 178 deletions.
75 changes: 46 additions & 29 deletions html/climate.html
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,15 @@
var table = $table.DataTable(options);
$el.data('datatable', table);

if ('rowGroup' in options) {
// Maintain RowGroup dataSrc when columns are reordered (#1109)
table.on('column-reorder', function(e, settings, details) {
var oldDataSrc = table.rowGroup().dataSrc();
var newDataSrc = details.mapping[oldDataSrc];
table.rowGroup().dataSrc(newDataSrc);
});
}

// Unregister previous Crosstalk event subscriptions, if they exist
if (instance.ctfilterSubscription) {
instance.ctfilterHandle.off("change", instance.ctfilterSubscription);
Expand Down Expand Up @@ -2206,6 +2215,7 @@
};

if (data.filter !== 'none') {
if (!data.hasOwnProperty('filterSettings')) data.filterSettings = {};

filterRow.each(function(i, td) {

Expand Down Expand Up @@ -2269,7 +2279,7 @@
}
});
var $input2 = $x.children('select');
filter = $input2.selectize({
filter = $input2.selectize($.extend({
options: $input2.data('options').map(function(v, i) {
return ({text: v, value: v});
}),
Expand All @@ -2288,8 +2298,7 @@
$td.data('filter', value.length > 0);
table.draw(); // redraw table, and filters will be applied
}
});
if (searchCol) filter[0].selectize.setValue(JSON.parse(searchCol));
}, data.filterSettings.select));
filter[0].selectize.on('blur', function() {
$x.hide().trigger('hide'); $input.parent().show(); $input.trigger('blur');
});
Expand All @@ -2298,10 +2307,12 @@
var fun = function() {
searchColumn(i, $input.val()).draw();
};
if (server) {
fun = $.fn.dataTable.util.throttle(fun, options.searchDelay);
}
$input.on('input', fun);
// throttle searching for server-side processing
var throttledFun = $.fn.dataTable.util.throttle(fun, options.searchDelay);
$input.on('input', function(e, immediate) {
// always bypass throttling when immediate = true (via the updateSearch method)
(immediate || !server) ? fun() : throttledFun();
});
} else if (inArray(type, ['number', 'integer', 'date', 'time'])) {
var $x0 = $x;
$x = $x0.children('div').first();
Expand Down Expand Up @@ -2387,13 +2398,11 @@
filter.val(v);
}
});
var formatDate = function(d, isoFmt) {
var formatDate = function(d) {
d = scaleBack(d, scale);
if (type === 'number') return d;
if (type === 'integer') return parseInt(d);
var x = new Date(+d);
var fmt = ('filterDateFmt' in data) ? data.filterDateFmt[i] : undefined;
if (fmt !== undefined && isoFmt === false) return x[fmt.method].apply(x, fmt.params);
if (type === 'date') {
var pad0 = function(x) {
return ('0' + x).substr(-2, 2);
Expand All @@ -2414,7 +2423,7 @@
start: [r1, r2],
range: {min: r1, max: r2},
connect: true
}, opts));
}, opts, data.filterSettings.slider));
if (scale > 1) (function() {
var t1 = r1, t2 = r2;
var val = filter.val();
Expand All @@ -2429,13 +2438,28 @@
start: [t1, t2],
range: {min: t1, max: t2},
connect: true
}, opts), true);
}, opts, data.filterSettings.slider), true);
val = filter.val();
}
r1 = t1; r2 = t2;
})();
// format with active column renderer, if defined
var colDef = data.options.columnDefs.find(function(def) {
return (def.targets === i || inArray(i, def.targets)) && 'render' in def;
});
var updateSliderText = function(v1, v2) {
$span1.text(formatDate(v1, false)); $span2.text(formatDate(v2, false));
// we only know how to use function renderers
if (colDef && typeof colDef.render === 'function') {
var restore = function(v) {
v = scaleBack(v, scale);
return inArray(type, ['date', 'time']) ? new Date(+v) : v;
}
$span1.text(colDef.render(restore(v1), 'display'));
$span2.text(colDef.render(restore(v2), 'display'));
} else {
$span1.text(formatDate(v1));
$span2.text(formatDate(v2));
}
};
updateSliderText(r1, r2);
var updateSlider = function(e) {
Expand Down Expand Up @@ -2468,7 +2492,7 @@
// processing
if (server) {
// if a search string has been pre-set, search now
if (searchCol) searchColumn(i, searchCol).draw();
if (searchCol) $input.trigger('input').trigger('change');
return;
}

Expand Down Expand Up @@ -2514,15 +2538,7 @@
$.fn.dataTable.ext.search.push(customFilter);

// search for the preset search strings if it is non-empty
if (searchCol) {
if (inArray(type, ['factor', 'logical'])) {
filter[0].selectize.setValue(JSON.parse(searchCol));
} else if (type === 'character') {
$input.trigger('input');
} else if (inArray(type, ['number', 'integer', 'date', 'time'])) {
$input.trigger('change');
}
}
if (searchCol) $input.trigger('input').trigger('change');

});

Expand Down Expand Up @@ -3170,8 +3186,9 @@
console.log('The search keyword for column ' + i + ' is undefined')
return;
}
$(td).find('input').first().val(v).trigger('input');
searchColumn(i, v);
// Update column search string and values on linked filter widgets.
// 'input' for factor and char filters, 'change' for numeric filters.
$(td).find('input').first().val(v).trigger('input', [true]).trigger('change');
});
table.draw();
}
Expand Down Expand Up @@ -5101,8 +5118,8 @@ <h3>ays-v0</h3>
<div class="knitr-options" data-fig-width="576" data-fig-height="460">

</div>
<div class="datatables html-widget html-fill-item" id="htmlwidget-54ca2738bc9f9963d295" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-54ca2738bc9f9963d295">{"x":{"style":"bootstrap5","filter":"none","vertical":false,"fillContainer":false,"data":[["1","2"],["PPO","A2C"],["team_vanilla","carl"],[99,49],[0,0],["<a href=https://github.com/mlap/test-rl-leaderboard/blob/e702a9809687c54a3200aa8e2238a61e7cdb0dc7/ays-v0-PPO-team_vanilla.zip>link <\/a>","<a href=https://github.com/cboettig/carl-climate-agents//blob/86a7a924b5545c5550e171b867afe37f00ef376b/ays-v0-A2C-carl.zip>link <\/a>"]],"container":"<table class=\"table table-striped table-hover row-border order-column display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>agent<\/th>\n <th>team<\/th>\n <th>mean<\/th>\n <th>std<\/th>\n <th>ref<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"order":[3,"desc"],"columnDefs":[{"className":"dt-right","targets":[3,4]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"agent","targets":1},{"name":"team","targets":2},{"name":"mean","targets":3},{"name":"std","targets":4},{"name":"ref","targets":5}],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
<div class="datatables html-widget html-fill-item" id="htmlwidget-130a17d525c4e72c4ea9" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-130a17d525c4e72c4ea9">{"x":{"style":"bootstrap5","filter":"none","vertical":false,"fillContainer":false,"data":[["1","2"],["PPO","A2C"],["team_vanilla","carl"],[99,49],[0,0],["<a href=https://github.com/mlap/test-rl-leaderboard/blob/e702a9809687c54a3200aa8e2238a61e7cdb0dc7/ays-v0-PPO-team_vanilla.zip>link <\/a>","<a href=https://github.com/cboettig/carl-climate-agents//blob/86a7a924b5545c5550e171b867afe37f00ef376b/ays-v0-A2C-carl.zip>link <\/a>"]],"container":"<table class=\"table table-striped table-hover row-border order-column display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>agent<\/th>\n <th>team<\/th>\n <th>mean<\/th>\n <th>std<\/th>\n <th>ref<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"order":[3,"desc"],"columnDefs":[{"className":"dt-right","targets":[3,4]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"agent","targets":1},{"name":"team","targets":2},{"name":"mean","targets":3},{"name":"std","targets":4},{"name":"ref","targets":5}],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
<hr />
<p>ays-v0 implements the AYS model first described in <a href="https://arxiv.org/pdf/1706.04542.pdf">Kittel et al.</a> that
phenomenologically models emissions, economic output and growth of
Expand All @@ -5126,8 +5143,8 @@ <h3>dice-v0</h3>
<div class="knitr-options" data-fig-width="576" data-fig-height="460">

</div>
<div class="datatables html-widget html-fill-item" id="htmlwidget-62e02faf2e08557209a0" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-62e02faf2e08557209a0">{"x":{"style":"bootstrap5","filter":"none","vertical":false,"fillContainer":false,"data":[[],[],[],[],[],[]],"container":"<table class=\"table table-striped table-hover row-border order-column display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>agent<\/th>\n <th>team<\/th>\n <th>mean<\/th>\n <th>std<\/th>\n <th>ref<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"order":[3,"desc"],"columnDefs":[{"className":"dt-right","targets":[3,4]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"agent","targets":1},{"name":"team","targets":2},{"name":"mean","targets":3},{"name":"std","targets":4},{"name":"ref","targets":5}],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
<div class="datatables html-widget html-fill-item" id="htmlwidget-a164770e3b1dac041d76" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-a164770e3b1dac041d76">{"x":{"style":"bootstrap5","filter":"none","vertical":false,"fillContainer":false,"data":[[],[],[],[],[],[]],"container":"<table class=\"table table-striped table-hover row-border order-column display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>agent<\/th>\n <th>team<\/th>\n <th>mean<\/th>\n <th>std<\/th>\n <th>ref<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"order":[3,"desc"],"columnDefs":[{"className":"dt-right","targets":[3,4]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"agent","targets":1},{"name":"team","targets":2},{"name":"mean","targets":3},{"name":"std","targets":4},{"name":"ref","targets":5}],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
<hr />
<p>dice-v0 implements <a href="http://www.econ.yale.edu/~nordhaus/homepage/homepage/documents/DICE_Manual_100413r1.pdf">Nordhaus’
DICE model</a> which is a richly detailed integrated assessment model.
Expand Down
Loading

0 comments on commit 54faf53

Please sign in to comment.