var 2018 Version Demo Page

Example #1 - FDA Rounding Off - Use %DV for Vitamin D, Potassium, Iron and Calcium

let min = 100;
let max = 1000;

$('#test1').nutritionLabel({
	itemName : 'Demo FDA Rounding Off',

	valueServingWeightGrams : Math.floor((Math.random() * max) + min) * .1,
	valueServingPerContainer : Math.floor((Math.random() * max) + min) * .1,
	valueCalories : Math.floor((Math.random() * max) + min) * .1,
	valueFatCalories : Math.floor((Math.random() * max) + min) * .1,
	valueTotalFat : Math.floor((Math.random() * max) + min) * .1,
	valueSatFat : Math.floor((Math.random() * max) + min) * .1,
	valueTransFat : Math.floor((Math.random() * max) + min) * .1,
	valuePolyFat : Math.floor((Math.random() * max) + min) * .1,
	valueMonoFat : Math.floor((Math.random() * max) + min) * .1,
	valueCholesterol : Math.floor((Math.random() * max) + min) * .1,
	valueSodium : Math.floor((Math.random() * max) + min) * .1,
	valuePotassium : Math.floor((Math.random() * max) + min) * .1, //this is for the legacy version
	valuePotassium_2018 : Math.floor((Math.random() * max) + min) * .1, //this is for the 2018 version
	valueTotalCarb : Math.floor((Math.random() * max) + min) * .1,
	valueFibers : Math.floor((Math.random() * max) + min) * .1,
	valueSugars : Math.floor((Math.random() * max) + min) * .1,
	valueAddedSugars : Math.floor((Math.random() * max) + min) * .1,
	valueProteins : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminA : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminC : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminD : Math.floor((Math.random() * max) + min) * .1,
	valueCalcium : Math.floor((Math.random() * max) + min) * .1,
	valueIron : Math.floor((Math.random() * max) + min) * .1,
	valueCaffeine : Math.floor((Math.random() * max) + min) * .1,

	showLegacyVersion : false
});



Example #2 - FDA Rounding On - Use %DV for Vitamin D, Potassium, Iron and Calcium

let min = 100;
let max = 1000;

$('#test2').nutritionLabel({
	itemName : 'Demo FDA Rounding On',
	allowFDARounding : true,

	valueServingWeightGrams : Math.floor((Math.random() * max) + min) * .1,
	valueServingPerContainer : Math.floor((Math.random() * max) + min) * .1,
	valueCalories : Math.floor((Math.random() * max) + min) * .1,
	valueFatCalories : Math.floor((Math.random() * max) + min) * .1,
	valueTotalFat : Math.floor((Math.random() * max) + min) * .1,
	valueSatFat : Math.floor((Math.random() * max) + min) * .1,
	valueTransFat : Math.floor((Math.random() * max) + min) * .1,
	valuePolyFat : Math.floor((Math.random() * max) + min) * .1,
	valueMonoFat : Math.floor((Math.random() * max) + min) * .1,
	valueCholesterol : Math.floor((Math.random() * max) + min) * .1,
	valueSodium : Math.floor((Math.random() * max) + min) * .1,
	valuePotassium : Math.floor((Math.random() * max) + min) * .1, //this is for the legacy version
	valuePotassium_2018 : Math.floor((Math.random() * max) + min) * .1, //this is for the 2018 version
	valueTotalCarb : Math.floor((Math.random() * max) + min) * .1,
	valueFibers : Math.floor((Math.random() * max) + min) * .1,
	valueSugars : Math.floor((Math.random() * max) + min) * .1,
	valueAddedSugars : Math.floor((Math.random() * max) + min) * .1,
	valueProteins : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminA : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminC : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminD : Math.floor((Math.random() * max) + min) * .1,
	valueCalcium : Math.floor((Math.random() * max) + min) * .1,
	valueIron : Math.floor((Math.random() * max) + min) * .1,
	valueCaffeine : Math.floor((Math.random() * max) + min) * .1,

	showLegacyVersion : false
});



Example #3 - FDA Rounding Off - Use Base Values for Vitamin D, Potassium, Iron and Calcium

let min = 100;
let max = 1000;
let minVitaminDIron = 50;
let maxVitaminDIron = 100;
let minCalcium = 100;
let maxCalcium = 1500;
let minPotassium = 100;
let maxPotassium = 1500;

$('#test3').nutritionLabel({
	itemName : 'Demo FDA Rounding Off',
	useBaseValueFor2018LabelAndNotDVPercentage : true,

	valueServingWeightGrams : Math.floor((Math.random() * max) + min) * .1,
	valueServingPerContainer : Math.floor((Math.random() * max) + min) * .1,
	valueCalories : Math.floor((Math.random() * max) + min) * .1,
	valueFatCalories : Math.floor((Math.random() * max) + min) * .1,
	valueTotalFat : Math.floor((Math.random() * max) + min) * .1,
	valueSatFat : Math.floor((Math.random() * max) + min) * .1,
	valueTransFat : Math.floor((Math.random() * max) + min) * .1,
	valuePolyFat : Math.floor((Math.random() * max) + min) * .1,
	valueMonoFat : Math.floor((Math.random() * max) + min) * .1,
	valueCholesterol : Math.floor((Math.random() * max) + min) * .1,
	valueSodium : Math.floor((Math.random() * max) + min) * .1,
	valuePotassium : Math.floor((Math.random() * max) + min) * .1, //this is for the legacy version
	valuePotassium_2018 : Math.floor((Math.random() * maxPotassium) + minPotassium) * .1, //this is for the 2018 version
	valueTotalCarb : Math.floor((Math.random() * max) + min) * .1,
	valueFibers : Math.floor((Math.random() * max) + min) * .1,
	valueSugars : Math.floor((Math.random() * max) + min) * .1,
	valueAddedSugars : Math.floor((Math.random() * max) + min) * .1,
	valueProteins : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminA : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminC : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminD : Math.floor((Math.random() * maxVitaminDIron) + minVitaminDIron) * .1,
	valueCalcium : Math.floor((Math.random() * maxCalcium) + minCalcium) * .1,
	valueIron : Math.floor((Math.random() * maxVitaminDIron) + minVitaminDIron) * .1,
	valueCaffeine : Math.floor((Math.random() * max) + min) * .1,

	showLegacyVersion : false
});



Example #4 - FDA Rounding On - Use Base Values for Vitamin D, Potassium, Iron and Calcium

let min = 100;
let max = 1000;
let minVitaminDIron = 50;
let maxVitaminDIron = 100;
let minCalcium = 100;
let maxCalcium = 1500;
let minPotassium = 100;
let maxPotassium = 1500;

$('#test4').nutritionLabel({
	itemName : 'Demo FDA Rounding On',
	allowFDARounding : true,

	valueServingWeightGrams : Math.floor((Math.random() * max) + min) * .1,
	valueServingPerContainer : Math.floor((Math.random() * max) + min) * .1,
	valueCalories : Math.floor((Math.random() * max) + min) * .1,
	valueFatCalories : Math.floor((Math.random() * max) + min) * .1,
	valueTotalFat : Math.floor((Math.random() * max) + min) * .1,
	valueSatFat : Math.floor((Math.random() * max) + min) * .1,
	valueTransFat : Math.floor((Math.random() * max) + min) * .1,
	valuePolyFat : Math.floor((Math.random() * max) + min) * .1,
	valueMonoFat : Math.floor((Math.random() * max) + min) * .1,
	valueCholesterol : Math.floor((Math.random() * max) + min) * .1,
	valueSodium : Math.floor((Math.random() * max) + min) * .1,
	valuePotassium : Math.floor((Math.random() * max) + min) * .1, //this is for the legacy version
	valuePotassium_2018 : Math.floor((Math.random() * maxPotassium) + minPotassium) * .1, //this is for the 2018 version
	valueTotalCarb : Math.floor((Math.random() * max) + min) * .1,
	valueFibers : Math.floor((Math.random() * max) + min) * .1,
	valueSugars : Math.floor((Math.random() * max) + min) * .1,
	valueAddedSugars : Math.floor((Math.random() * max) + min) * .1,
	valueProteins : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminA : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminC : Math.floor((Math.random() * max) + min) * .1,
	valueVitaminD : Math.floor((Math.random() * maxVitaminDIron) + minVitaminDIron) * .1,
	valueCalcium : Math.floor((Math.random() * maxCalcium) + minCalcium) * .1,
	valueIron : Math.floor((Math.random() * maxVitaminDIron) + minVitaminDIron) * .1,
	valueCaffeine : Math.floor((Math.random() * max) + min) * .1,

	showLegacyVersion : false
});