You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cryptpad/www/common/inner/charts.js

55 lines
1.2 KiB
JavaScript

define([
'/common/hyperscript.js',
], function (h) {
var Charts = {};
Charts.table = function (content, classes) {
var classString = Array.isArray(classes)? '.' + classes.join('.'): '';
return h('table' + classString, content);
};
Charts.columns = function (rows) {
return Charts.table([
//h('caption', "Front-End Developer Salary"),
h('tbody', rows.map(function (n) {
return h('tr', h('td', {
style: '--size: ' + (n / 100),
}, h('span.data', n)));
})),
], [
'charts-css',
'column',
'show-heading',
]);
};
Charts.row = function (text, count, data) {
return h('tr', [
h('th', {
scope: 'row',
}, text),
h('td', {
style: '--size: ' + count,
}, [
//text,
typeof(data) !== 'undefined'? h('span.data', data): text,
])
]);
};
// table.charts-css.bar.reverse
/*
Charts.bars = function (rows) {
return Charts.table([
], [
]);
};
*/
return Charts;
});