Best Practices for Implementing Seasonality Data Input and Charting on

Hello Bubble Community,

I’m working on a project involving agricultural commodities and their seasonality data (i.e., the percentage of annual harvest per month for each commodity). I’m seeking advice on the best approach to implement the following features in

  1. Data Structure: How should I store the seasonality data? I’m contemplating whether to use a list of numbers (but I’m concerned about maintaining the chronological order of months), or to create a new Data Type specifically for this purpose. Alternatively, should I incorporate fields for each month within the existing commodity Data Type?
  2. Data Input: For collecting the percentage of harvested volume per month, would it be better to use a repeating group or set up 12 individual input fields? Any suggestions on efficient and user-friendly data entry methods would be appreciated.
  3. Charting: Once the data is collected, I would like to plot it on a line chart. Could anyone share insights or resources on how to dynamically generate a line chart based on the entered seasonality data?
  4. Data Validation: I aim to ensure that the total percentage of harvested volume across all months adds up to 100%. What are the best practices in to implement such validation constraints?

Thank you in advance for your guidance and expertise!

I would create a new data type. Technically, each seasonality data point should be self-contained with the month etc.

You can create a repeating group for the sake of making things easier on the design. So, you don’t handle each input differently. But I would still try to make it more user friendly like maybe some slider maybe. But this time, you need to deal with adding it to the database when the user types/slides immediately.

Line chart is pretty straight forward. X axis will be 1-12 months and Y axis will be the percentage value for Current Point.

If you will take the repeating group route, you can do it with a custom state. Whenever a number is entered for one of the months, add it to the custom state as well. So, you will always know what is total and warn the user if it exceeds 100.