Skip to content
    Back to all Bounties

    Earn 1,800 ($18.00)

    Time Remainingdue 1 year ago
    Completed

    Add Regression Equation to Chart.js instance

    access2tools
    access2tools
    Posted 1 year ago
    This Bounty has been completed!
    @access2tools's review of @Sahajsingh7
    5.0
    Average Rating
    Communication 5/5, Quality 5/5, Timeliness 5/5
    “Great communication and helpful comments on the submitted code! ”

    Bounty Description

    Current Status

    The chart takes two parameters from the HTML sliders: dosage and fitness. Event handling and updating is already resolved. What is needed is the implementation of an exponential decay equation in function calculateRegression() that approximates to meet the following conditions:

    • Accepts three parameters: dosage, fitness, and time
    • Initial dosage (t=1) matches dosage set in HTML slider
    • Value of t incremented in updateChart() -> already implemented
    • Y-value decreases at exponential decay rate until it reaches the appropriate y-intercept (defined below)

    Equation requirements

    • when fitness = 100, resulting slope is 0
    • when fitness = 99, the equation causes the line to converge with y=0 at week 8
    • when fitness = 98, the equation causes the line to converge with y=0 at week 8
    • when fitness = 97, the equation causes the line to converge with y=0 at week 7
    • when fitness = 96, the equation causes the line to converge with y=0 at week 6
    • when fitness = 95, the equation causes the line to converge with y=0 at week 6
    • when fitness = 94, the equation causes the line to converge with y=0 at week 5
    • when fitness = 93, the equation causes the line to converge with y=0 at week 5
    • when fitness = 92, the equation causes the line to converge with y=0 at week 4
    • when fitness = 91, the equation causes the line to converge with y=0 at week 4
    • when fitness = 90, the equation causes the line to converge with y=0 at week 3
    • when fitness = 89, the equation causes the line to converge with y=0 at week 3
    • when fitness = 88 to 84, the equation causes the line to converge with y=0 at week 2
    • when fitness = 83 to 80, the equation causes the line to converge with y=0 at week 1

    The range of fitness is 80-100, so this covers all possible fitness values.

    The dosage at t=1 should always be equal to the HTML slider’s value of dosage, however each consequent dosage (y-value) can be approximate -> it is just important that the slopes have the same shape and intensity for each fitness. This means that the slope when (fitness=90, dosage=10 billion) should be the same shape as when (fitness = 90, dosage = 400 million). Point is, each fitness slope should just shift up and down depending on the dosage.

    Example Screenshots

    Located in replit... unable to add photos to bounty post :(

    Additional features to add

    • Implement existing formatDosage() function to chart's y-axis labels
    • Make each point an image, using provided ./dna.png

    Link to Project

    https://replit.com/@access2tools/Interactive-Regression-using-Chartjs#chart.js

    Chart.js documentation

    https://www.chartjs.org/docs/latest/

    Example Screenshots

    Unsupported image