Coder Social home page Coder Social logo

ng-calendar-heatmap's Introduction

matse.dev · pages-build-deployment · License: MIT

my webpage based on jeykll.

bundle install
bundle exec jekyll serve

ng-calendar-heatmap's People

Contributors

dependabot[bot] avatar matseee avatar

Stargazers

 avatar

Watchers

 avatar

ng-calendar-heatmap's Issues

Tooltip date format (evolution)

Hello,
Very good module, can you however add a functionality (missing for me), namely the format of the date in the tooltip?

Currently the format is 'ddd, MMM Do YYYY' which is not suitable for my country (France).

I think the following code should suffice in calendar.local.d.ts (models folder):

export interface CalendarLocale {
    months: string [];
    days: string [];
    no: string;
    on: string;
    less: string;
    more: string;
    dateMomentFormat: string;
}

Then change into ng-calendar-heatmap.js.map file change getDefaultOptions () function to:

function getDefaultOptions () {
    return {
        width: 705,
        height: 110,
        responsive: false,
        legendWidth: 95,
        SQUARE_LENGTH: 11,
        SQUARE_PADDING: 2,
        MONTH_LABEL_PADDING: 6,
        DAY_WIDTH: 12,
        MONTH_LABEL_HEIGHT: 10,
        now: new Date (),
        yearAgo: new Date (),
        startDate: null,
        max: null,
        colorRange: ['# D8E6E7', '# 218380'],
        tooltipEnabled: true,
        tooltipUnit: 'contribution',
        legendEnabled: true,
        onClick: null,
        weekStart: CalendarWeekStart.SUNDAY,
        local: {
            months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
            days: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
            no: 'No',
            on: 'on',
            less: 'Less',
            more: 'More',
            dateMomentFormat: 'ddd, MMM Do YYYY'
        }
    };
}

Finally, by modifying the tooltipHTMLForDate (d) function:

tooltipHTMLForDate(d) {
        const dateStr = time (d).format(this.options.locale.dateMomentFormat);
        const count = this.countForDate(d);
        return '<span> <strong>'
            + (count? count: this.options.locale.no)
            + '' + this.pluralizedTooltipUnit(count)
            + '</strong>' + this.options.locale.on + '' + dateStr
            + '</span>';
}

If you could do that it will be perfect (for me among others).
Good continuation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.