question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Proposal] Overall Percent Chance

See original GitHub issue

Hello,

I was wondering if this could be an additional feature to continue with the statistic trend.

image

I made a working sample for the current version as of 4/12/2020. It loops through the data found in the table and adds all of the percent chances per category.

I use the Custom JavaScript for Websites 2 extension for Chrome to run outside scripts into a page. If anyone wants to sample this in their own browser, you can use the following JavaScript code:

var trend = {};

function getChances() {
  trend = {
    random: {
      chance: 0,
      count: 0,
      min: 0,
      max: 0
    },
    down: {
      chance: 0,
      count: 0,
      min: 0,
      max: 0
    },
    small: {
      chance: 0,
      count: 0,
      min: 0,
      max: 0
    },
    large: {
      chance: 0,
      count: 0,
      min: 0,
      max: 0
    }
  }
  $('#output tr').each(function(){
    var type = $(this).children('td:nth-child(1)').text();
    var percent = parseFloat($(this).children('td:nth-child(2)').text());
    var low = parseInt($(this).children('td:nth-child(16)').text());
    var high = parseInt($(this).children('td:nth-child(17)').text());
    
    switch (type) {
      case 'Fluctuating':
        type = trend.random;
        break;
      case 'Decreasing':
        type = trend.down;
        break;
      case 'Small spike':
        type = trend.small;
        break;
      case 'Large spike':
        type = trend.large;
        break;
    }
    
    type.chance = percent;
    type.count++;
    type.min = low;
    type.max = high;
  });
  
  var totalCount = trend.large.count + trend.small.count + trend.random.count + trend.down.count;
  var randomChance = isNaN(trend.random.chance) ? `${((trend.random.count / totalCount) * 100).toFixed(0)}%` : `${(trend.random.chance * trend.random.count).toFixed(0)}%`;
  var downChance = isNaN(trend.down.chance) ? `${((trend.down.count / totalCount) * 100).toFixed(0)}%` : `${(trend.down.chance * trend.down.count).toFixed(0)}%`;
  var smallChance = isNaN(trend.small.chance) ? `${((trend.small.count / totalCount) * 100).toFixed(0)}%` : `${(trend.small.chance * trend.small.count).toFixed(0)}%`;
  var largeChance = isNaN(trend.large.chance) ? `${((trend.large.count / totalCount) * 100).toFixed(0)}%` : `${(trend.large.chance * trend.large.count).toFixed(0)}%`;
  
  $('.table-wrapper').before(`<div id="extraStats">
    <style>
      #extraStats, #extraStats>div {
        width: 100%;
        display: flex;
        justify-content: space-around;
      }
      #extraStats>div>div>* {
        text-align: center;
      }
      @media (max-width: 768px) {
        #extraStats {
          flex-direction: column;
        }
      }
    </style>
    <div>
      <div>
        <h2>Fluctuating</h2>
        <h3>Chance: ${randomChance}</h3>
        <h3>Min/Max: ${trend.random.min}~${trend.random.max}</h3>
      </div>
      <div>
        <h2>Decreasing</h2>
        <h3>Chance: ${downChance}</h3>
        <h3>Min/Max: ${trend.down.min}~${trend.down.max}</h3>
      </div>
    </div>
    <div>
      <div>
        <h2>Small Spike</h2>
        <h3>Chance: ${smallChance}</h3>
        <h3>Min/Max: ${trend.small.min}~${trend.small.max}</h3>
      </div>
      <div>
        <h2>Large Spike</h2>
        <h3>Chance: ${largeChance}</h3>
        <h3>Min/Max: ${trend.large.min}~${trend.large.max}</h3>
      </div>
    </div>
  </div>`);
}

getChances();

$('body').on('DOMSubtreeModified', '#output', function(){
  $('#extraStats').remove();
  getChances();
});

Edit: I have modified the above code to include other added suggestions discussed in this issue.

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nbernabe09commented, Apr 14, 2020

Using this webapp in both desktop and mobile conditions, I was overcome with information overload, having to horizontal scroll through the table information to see everything making the experience a little frustrating.

I would suggest adding a new table with a summary of all the information in the table, an “at a glance” look.

Trend          | Large Spike
---------------|-------------
Total % Chance |     50%
---------------|-------------
Potential Gain |   450~600

Stalk Market Wizard uses this method, only supplying the user on when to hold or sell based on the user’s information, but does not share its findings on possible outcomes.

As more user input is supplied, the original table becomes more relevant to the user. Using this “at a glance” approach could simplify the user’s decision on whether to hold or sell without having to parse though multiple rows of possible outcomes.

0reactions
ChiefMilesEdgeworthcommented, Apr 15, 2020

I recommend attaching the total category chance to each possibility in that category, and then just taking the first of a category and rowspanning it. It will be hard to sort the rows in order of total category chance if you can’t compare an individual row to another to check for that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

7.2 Proposals – Technical Writing Essentials
Provide an itemized budget for completing the proposed project. This is your last chance to convince the reader; be persuasive! List your research...
Read more >
How to Write a Proposal for a Project • Asana
A project proposal outlines everything stakeholders should know about a project. In this guide, we'll teach you how to write one so you...
Read more >
How to Write a Proposal and Get What You Want (Free ...
Use this template to guide you when you are writing a grant proposal. 1. Introduction to the Proposal Template Checklist Process: 2. Complete ......
Read more >
How To Write a Project Proposal (With Tips and Example)
Include the most important information needed to enhance your chances of receiving approval. Benefits of a good project proposal. A good project ...
Read more >
How to Write a Business Proposal [Examples + Template]
Include a signature box for the client to sign and let them know exactly what they're agreeing to when they sign. This is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found