You've already forked wakapi-readme-stats
Bar graph added.
This commit is contained in:
46
node_modules/d3-scale/src/ordinal.js
generated
vendored
Normal file
46
node_modules/d3-scale/src/ordinal.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
import {initRange} from "./init.js";
|
||||
|
||||
export const implicit = Symbol("implicit");
|
||||
|
||||
export default function ordinal() {
|
||||
var index = new Map(),
|
||||
domain = [],
|
||||
range = [],
|
||||
unknown = implicit;
|
||||
|
||||
function scale(d) {
|
||||
var key = d + "", i = index.get(key);
|
||||
if (!i) {
|
||||
if (unknown !== implicit) return unknown;
|
||||
index.set(key, i = domain.push(d));
|
||||
}
|
||||
return range[(i - 1) % range.length];
|
||||
}
|
||||
|
||||
scale.domain = function(_) {
|
||||
if (!arguments.length) return domain.slice();
|
||||
domain = [], index = new Map();
|
||||
for (const value of _) {
|
||||
const key = value + "";
|
||||
if (index.has(key)) continue;
|
||||
index.set(key, domain.push(value));
|
||||
}
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.range = function(_) {
|
||||
return arguments.length ? (range = Array.from(_), scale) : range.slice();
|
||||
};
|
||||
|
||||
scale.unknown = function(_) {
|
||||
return arguments.length ? (unknown = _, scale) : unknown;
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return ordinal(domain, range).unknown(unknown);
|
||||
};
|
||||
|
||||
initRange.apply(scale, arguments);
|
||||
|
||||
return scale;
|
||||
}
|
||||
Reference in New Issue
Block a user