Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add forecast #579

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

mbauchet
Copy link
Collaborator

@mbauchet mbauchet commented Jul 23, 2023

Description
Adding a forecast line to LineChart (and AreaChart).
New properties:

  • forecastCategories that works like categories but for the forecast datas (Allows different label than default datas). It can also have multiple forecast lines for one data by passing an array of categories
  forecastCategories: ["Sales Forecast", "Successful Payments Forecast"] //for single forecast line by category

  forecastCategories: [["Sales Forecast Max", "Sales Forecast Min"], ["Successful Payments Forecast Max", "Successful Payments Forecast Min"]] //for two forecast lines by category

  • forecastLineStyle that allow you to change the style for the forecast line (solid, dashed, dotted)

Related issue(s)
#572

What kind of change does this PR introduce? (check at least one)

  • Bug fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

How has This been tested?
Using StoryBook

Screenshots (if appropriate):
Capture d’écran 2023-07-23 à 22 26 53

The PR fulfills these requirements:

  • It's submitted to the main branch
  • When resolving a specific issue, it's referenced in the related issue section above
  • My change requires a change to the documentation. (Managed by Tremor Team)
  • I have added tests to cover my changes
  • Check the "Allow edits from maintainers" option while creating your PR.
  • Add refs #XXX or fixes #XXX to the related issue section if your PR refers to or fixes an issue.

@gondar00
Copy link

@severinlandolt any plans of adding this into the coming releases?

@severinlandolt severinlandolt linked an issue Oct 18, 2023 that may be closed by this pull request
@nextjs-tsadei
Copy link

Any update on this PR? ANy plan to merge ?

if (hasCategoryValue) {
objectsWithCategories++;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that you can write the above code (from line 29) as follows:

const objectsWithCategories = data.reduce((count, obj) => 
  count + categories.flat().some(c => obj.hasOwnProperty(c) && obj[c] !== null && obj[c] !== undefined), 
  0
)

if(!categories)
return 0;

const totalObjects = data.length + 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why you are adding 1 here? Maybe I am missing something obvious but it looks incorrect? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Add forecast line
4 participants