import * as d3 from 'd3';
var D3Support = /** @class */ (function () {
    function D3Support() {
    }
    D3Support.initSvg = function (svg, width, height, margin) {
        console.debug("Width: " + width);
        console.debug("Weight: " + height);
        return svg
            .attr('width', width)
            .attr('height', height)
            .append('g')
            .attr('width', width - margin.left - margin.right)
            .attr('height', height - margin.top - margin.bottom)
            .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
    };
    D3Support.uid = function (name) {
        function s4() {
            return Math.floor((1 + Math.random()) * 0x10000)
                .toString(16)
                .substring(1);
        }
        return { id: name + "-" + s4() };
    };
    D3Support.svg = function (width, height) {
        var svg = document.createElement("svg");
        svg.setAttribute("width", width + "");
        svg.setAttribute("height", height + "");
        svg.setAttribute("viewBox", "0,0," + width + "," + height);
        return svg;
    };
    D3Support.dayFormat = d3.timeFormat('%j');
    D3Support.monthDayFormat = d3.timeFormat('%m.%d');
    D3Support.getDayOfYear = function (date) { return parseInt(D3Support.dayFormat(date), 10); };
    D3Support.getMonthAndDay = function (date) { return D3Support.monthDayFormat(date); };
    return D3Support;
}());
export default D3Support;
//# sourceMappingURL=D3Support.js.map