Example #1 - Rounding Off; Decimal Place 1

var min = 200;
var max = 2000;

$('#test1').nutritionLabel({
	width : 380,
	showLegacyVersion : false,
	showUKVersion : true,
	showItemNameForUK : true,
	showDailySugars : true,

	dailyValueTotalFat : 70, //this should be 70 for the uk version
	dailyValueCarb : 260, //this should be 260 for the uk version
	dailyValueSugar : 90, //this should be 90 for the uk version

	textCalories : 'Energy',
	textTotalCarb : 'Carbohydrate',
	textFibers : 'Fibre',
	textSodium : 'Salt',

	itemName : 'Rounding Off; Decimal Place 1',

	valueServingWeightGrams : varValueServingWeightGrams = Math.floor((Math.random() * max) + min) * .01,
	valueCalories : varValueCalories = Math.floor((Math.random() * max) + min) * .01,
	valueTotalFat : varValueTotalFat = Math.floor((Math.random() * max) + min) * .01,
	valueSatFat : varValueSatFat = Math.floor((Math.random() * max) + min) * .01,
	valueTotalCarb : varValueTotalCarb = Math.floor((Math.random() * max) + min) * .01,
	valueSugars : varValueSugars = Math.floor((Math.random() * max) + min) * .01,
	valueFibers : varValueFibers = Math.floor((Math.random() * max) + min) * .01,
	valueProteins : varValueProteins = Math.floor((Math.random() * max) + min) * .01,
	valueSodium : varValueSodium = Math.floor((Math.random() * max) + min) * .01
});

$('#test1Data #varValueServingWeightGrams').html(varValueServingWeightGrams);
$('#test1Data #varValueCalories').html(varValueCalories);
$('#test1Data #varValueTotalFat').html(varValueTotalFat);
$('#test1Data #varValueSatFat').html(varValueSatFat);
$('#test1Data #varValueTotalCarb').html(varValueTotalCarb);
$('#test1Data #varValueSugars').html(varValueSugars);
$('#test1Data #varValueFibers').html(varValueFibers);
$('#test1Data #varValueProteins').html(varValueProteins);
$('#test1Data #varValueSodium').html(varValueSodium);



Example #2 - Rounding On; Decimal Place 1

var min = 200;
var max = 2000;

$('#test2').nutritionLabel({
	width : 380,
	showLegacyVersion : false,
	showUKVersion : true,
	showItemNameForUK : true,
	showDailySugars : true,

	dailyValueTotalFat : 70, //this should be 70 for the uk version
	dailyValueCarb : 260, //this should be 260 for the uk version
	dailyValueSugar : 90, //this should be 90 for the uk version

	textCalories : 'Energy',
	textTotalCarb : 'Carbohydrate',
	textFibers : 'Fibre',
	textSodium : 'Salt',

	itemName : 'Rounding On; Decimal Place 1',
	allowFDARounding : true,

	valueServingWeightGrams : varValueServingWeightGrams = Math.floor((Math.random() * max) + min) * .01,
	valueCalories : varValueCalories = Math.floor((Math.random() * max) + min) * .01,
	valueTotalFat : varValueTotalFat = Math.floor((Math.random() * max) + min) * .01,
	valueSatFat : varValueSatFat = Math.floor((Math.random() * max) + min) * .01,
	valueTotalCarb : varValueTotalCarb = Math.floor((Math.random() * max) + min) * .01,
	valueSugars : varValueSugars = Math.floor((Math.random() * max) + min) * .01,
	valueFibers : varValueFibers = Math.floor((Math.random() * max) + min) * .01,
	valueProteins : varValueProteins = Math.floor((Math.random() * max) + min) * .01,
	valueSodium : varValueSodium = Math.floor((Math.random() * max) + min) * .01
});

$('#test2Data #varValueServingWeightGrams').html(varValueServingWeightGrams);
$('#test2Data #varValueCalories').html(varValueCalories);
$('#test2Data #varValueTotalFat').html(varValueTotalFat);
$('#test2Data #varValueSatFat').html(varValueSatFat);
$('#test2Data #varValueTotalCarb').html(varValueTotalCarb);
$('#test2Data #varValueSugars').html(varValueSugars);
$('#test2Data #varValueFibers').html(varValueFibers);
$('#test2Data #varValueProteins').html(varValueProteins);
$('#test2Data #varValueSodium').html(varValueSodium);



Example #3 - Rounding Off; Decimal Place 2

var min = 2000;
var max = 20000;

$('#test3').nutritionLabel({
	width : 380,
	showLegacyVersion : false,
	showUKVersion : true,
	showItemNameForUK : true,
	showDailySugars : true,

	dailyValueTotalFat : 70, //this should be 70 for the uk version
	dailyValueCarb : 260, //this should be 260 for the uk version
	dailyValueSugar : 90, //this should be 90 for the uk version

	textCalories : 'Energy',
	textTotalCarb : 'Carbohydrate',
	textFibers : 'Fibre',
	textSodium : 'Salt',

	itemName : 'Rounding Off; Decimal Place 2',
	decimalPlacesForNutrition : 2,

	valueServingWeightGrams : varValueServingWeightGrams = Math.floor((Math.random() * max) + min) * .001,
	valueCalories : varValueCalories = Math.floor((Math.random() * max) + min) * .001,
	valueTotalFat : varValueTotalFat = Math.floor((Math.random() * max) + min) * .001,
	valueSatFat : varValueSatFat = Math.floor((Math.random() * max) + min) * .001,
	valueTotalCarb : varValueTotalCarb = Math.floor((Math.random() * max) + min) * .001,
	valueSugars : varValueSugars = Math.floor((Math.random() * max) + min) * .001,
	valueFibers : varValueFibers = Math.floor((Math.random() * max) + min) * .001,
	valueProteins : varValueProteins = Math.floor((Math.random() * max) + min) * .001,
	valueSodium : varValueSodium = Math.floor((Math.random() * max) + min) * .001
});

$('#test3Data #varValueServingWeightGrams').html(varValueServingWeightGrams);
$('#test3Data #varValueCalories').html(varValueCalories);
$('#test3Data #varValueTotalFat').html(varValueTotalFat);
$('#test3Data #varValueSatFat').html(varValueSatFat);
$('#test3Data #varValueTotalCarb').html(varValueTotalCarb);
$('#test3Data #varValueSugars').html(varValueSugars);
$('#test3Data #varValueFibers').html(varValueFibers);
$('#test3Data #varValueProteins').html(varValueProteins);
$('#test3Data #varValueSodium').html(varValueSodium);



Example #4 - Rounding On; Decimal Place 2

var min = 2000;
var max = 20000;

$('#test4').nutritionLabel({
	width : 380,
	showLegacyVersion : false,
	showUKVersion : true,
	showItemNameForUK : true,
	showDailySugars : true,

	dailyValueTotalFat : 70, //this should be 70 for the uk version
	dailyValueCarb : 260, //this should be 260 for the uk version
	dailyValueSugar : 90, //this should be 90 for the uk version

	textCalories : 'Energy',
	textTotalCarb : 'Carbohydrate',
	textFibers : 'Fibre',
	textSodium : 'Salt',

	itemName : 'Rounding On; Decimal Place 2',
	allowFDARounding : true,
	decimalPlacesForNutrition : 2,

	valueServingWeightGrams : varValueServingWeightGrams = Math.floor((Math.random() * max) + min) * .001,
	valueCalories : varValueCalories = Math.floor((Math.random() * max) + min) * .001,
	valueTotalFat : varValueTotalFat = Math.floor((Math.random() * max) + min) * .001,
	valueSatFat : varValueSatFat = Math.floor((Math.random() * max) + min) * .001,
	valueTotalCarb : varValueTotalCarb = Math.floor((Math.random() * max) + min) * .001,
	valueSugars : varValueSugars = Math.floor((Math.random() * max) + min) * .001,
	valueFibers : varValueFibers = Math.floor((Math.random() * max) + min) * .001,
	valueProteins : varValueProteins = Math.floor((Math.random() * max) + min) * .001,
	valueSodium : varValueSodium = Math.floor((Math.random() * max) + min) * .001
});

$('#test4Data #varValueServingWeightGrams').html(varValueServingWeightGrams);
$('#test4Data #varValueCalories').html(varValueCalories);
$('#test4Data #varValueTotalFat').html(varValueTotalFat);
$('#test4Data #varValueSatFat').html(varValueSatFat);
$('#test4Data #varValueTotalCarb').html(varValueTotalCarb);
$('#test4Data #varValueSugars').html(varValueSugars);
$('#test4Data #varValueFibers').html(varValueFibers);
$('#test4Data #varValueProteins').html(varValueProteins);
$('#test4Data #varValueSodium').html(varValueSodium);



Example #5 - Rounding Off; Decimal Place 3

var min = 20000;
var max = 200000;

$('#test5').nutritionLabel({
	width : 380,
	showLegacyVersion : false,
	showUKVersion : true,
	showItemNameForUK : true,
	showDailySugars : true,

	dailyValueTotalFat : 70, //this should be 70 for the uk version
	dailyValueCarb : 260, //this should be 260 for the uk version
	dailyValueSugar : 90, //this should be 90 for the uk version

	textCalories : 'Energy',
	textTotalCarb : 'Carbohydrate',
	textFibers : 'Fibre',
	textSodium : 'Salt',

	itemName : 'Rounding Off; Decimal Place 3',
	decimalPlacesForNutrition : 3,

	valueServingWeightGrams : varValueServingWeightGrams = Math.floor((Math.random() * max) + min) * .0001,
	valueCalories : varValueCalories = Math.floor((Math.random() * max) + min) * .0001,
	valueTotalFat : varValueTotalFat = Math.floor((Math.random() * max) + min) * .0001,
	valueSatFat : varValueSatFat = Math.floor((Math.random() * max) + min) * .0001,
	valueTotalCarb : varValueTotalCarb = Math.floor((Math.random() * max) + min) * .0001,
	valueSugars : varValueSugars = Math.floor((Math.random() * max) + min) * .0001,
	valueFibers : varValueFibers = Math.floor((Math.random() * max) + min) * .0001,
	valueProteins : varValueProteins = Math.floor((Math.random() * max) + min) * .0001,
	valueSodium : varValueSodium = Math.floor((Math.random() * max) + min) * .0001
});

$('#test5Data #varValueServingWeightGrams').html(varValueServingWeightGrams);
$('#test5Data #varValueCalories').html(varValueCalories);
$('#test5Data #varValueTotalFat').html(varValueTotalFat);
$('#test5Data #varValueSatFat').html(varValueSatFat);
$('#test5Data #varValueTotalCarb').html(varValueTotalCarb);
$('#test5Data #varValueSugars').html(varValueSugars);
$('#test5Data #varValueFibers').html(varValueFibers);
$('#test5Data #varValueProteins').html(varValueProteins);
$('#test5Data #varValueSodium').html(varValueSodium);



Example #6 - Rounding On; Decimal Place 3

var min = 20000;
var max = 200000;

$('#test6').nutritionLabel({
	width : 380,
	showLegacyVersion : false,
	showUKVersion : true,
	showItemNameForUK : true,
	showDailySugars : true,

	dailyValueTotalFat : 70, //this should be 70 for the uk version
	dailyValueCarb : 260, //this should be 260 for the uk version
	dailyValueSugar : 90, //this should be 90 for the uk version

	textCalories : 'Energy',
	textTotalCarb : 'Carbohydrate',
	textFibers : 'Fibre',
	textSodium : 'Salt',

	itemName : 'Rounding On; Decimal Place 3',
	allowFDARounding : true,
	decimalPlacesForNutrition : 3,

	valueServingWeightGrams : varValueServingWeightGrams = Math.floor((Math.random() * max) + min) * .0001,
	valueCalories : varValueCalories = Math.floor((Math.random() * max) + min) * .0001,
	valueTotalFat : varValueTotalFat = Math.floor((Math.random() * max) + min) * .0001,
	valueSatFat : varValueSatFat = Math.floor((Math.random() * max) + min) * .0001,
	valueTotalCarb : varValueTotalCarb = Math.floor((Math.random() * max) + min) * .0001,
	valueSugars : varValueSugars = Math.floor((Math.random() * max) + min) * .0001,
	valueFibers : varValueFibers = Math.floor((Math.random() * max) + min) * .0001,
	valueProteins : varValueProteins = Math.floor((Math.random() * max) + min) * .0001,
	valueSodium : varValueSodium = Math.floor((Math.random() * max) + min) * .0001
});

$('#test6Data #varValueServingWeightGrams').html(varValueServingWeightGrams);
$('#test6Data #varValueCalories').html(varValueCalories);
$('#test6Data #varValueTotalFat').html(varValueTotalFat);
$('#test6Data #varValueSatFat').html(varValueSatFat);
$('#test6Data #varValueTotalCarb').html(varValueTotalCarb);
$('#test6Data #varValueSugars').html(varValueSugars);
$('#test6Data #varValueFibers').html(varValueFibers);
$('#test6Data #varValueProteins').html(varValueProteins);
$('#test6Data #varValueSodium').html(varValueSodium);



Example #7 - Rounding Off; Decimal Place 4

var min = 200000;
var max = 2000000;

$('#test7').nutritionLabel({
	width : 380,
	showLegacyVersion : false,
	showUKVersion : true,
	showItemNameForUK : true,
	showDailySugars : true,

	dailyValueTotalFat : 70, //this should be 70 for the uk version
	dailyValueCarb : 260, //this should be 260 for the uk version
	dailyValueSugar : 90, //this should be 90 for the uk version

	textCalories : 'Energy',
	textTotalCarb : 'Carbohydrate',
	textFibers : 'Fibre',
	textSodium : 'Salt',

	itemName : 'Rounding Off; Decimal Place 4',
	decimalPlacesForNutrition : 4,

	valueServingWeightGrams : varValueServingWeightGrams = Math.floor((Math.random() * max) + min) * .00001,
	valueCalories : varValueCalories = Math.floor((Math.random() * max) + min) * .00001,
	valueTotalFat : varValueTotalFat = Math.floor((Math.random() * max) + min) * .00001,
	valueSatFat : varValueSatFat = Math.floor((Math.random() * max) + min) * .00001,
	valueTotalCarb : varValueTotalCarb = Math.floor((Math.random() * max) + min) * .00001,
	valueSugars : varValueSugars = Math.floor((Math.random() * max) + min) * .00001,
	valueFibers : varValueFibers = Math.floor((Math.random() * max) + min) * .00001,
	valueProteins : varValueProteins = Math.floor((Math.random() * max) + min) * .00001,
	valueSodium : varValueSodium = Math.floor((Math.random() * max) + min) * .00001
});

$('#test7Data #varValueServingWeightGrams').html(varValueServingWeightGrams);
$('#test7Data #varValueCalories').html(varValueCalories);
$('#test7Data #varValueTotalFat').html(varValueTotalFat);
$('#test7Data #varValueSatFat').html(varValueSatFat);
$('#test7Data #varValueTotalCarb').html(varValueTotalCarb);
$('#test7Data #varValueSugars').html(varValueSugars);
$('#test7Data #varValueFibers').html(varValueFibers);
$('#test7Data #varValueProteins').html(varValueProteins);
$('#test7Data #varValueSodium').html(varValueSodium);



Example #8 - Rounding On; Decimal Place 4

var min = 200000;
var max = 2000000;

$('#test8').nutritionLabel({
	width : 380,
	showLegacyVersion : false,
	showUKVersion : true,
	showItemNameForUK : true,
	showDailySugars : true,

	dailyValueTotalFat : 70, //this should be 70 for the uk version
	dailyValueCarb : 260, //this should be 260 for the uk version
	dailyValueSugar : 90, //this should be 90 for the uk version

	textCalories : 'Energy',
	textTotalCarb : 'Carbohydrate',
	textFibers : 'Fibre',
	textSodium : 'Salt',

	itemName : 'Rounding On; Decimal Place 4',
	allowFDARounding : true,
	decimalPlacesForNutrition : 4,

	valueServingWeightGrams : varValueServingWeightGrams = Math.floor((Math.random() * max) + min) * .00001,
	valueCalories : varValueCalories = Math.floor((Math.random() * max) + min) * .00001,
	valueTotalFat : varValueTotalFat = Math.floor((Math.random() * max) + min) * .00001,
	valueSatFat : varValueSatFat = Math.floor((Math.random() * max) + min) * .00001,
	valueTotalCarb : varValueTotalCarb = Math.floor((Math.random() * max) + min) * .00001,
	valueSugars : varValueSugars = Math.floor((Math.random() * max) + min) * .00001,
	valueFibers : varValueFibers = Math.floor((Math.random() * max) + min) * .00001,
	valueProteins : varValueProteins = Math.floor((Math.random() * max) + min) * .00001,
	valueSodium : varValueSodium = Math.floor((Math.random() * max) + min) * .00001
});

$('#test8Data #varValueServingWeightGrams').html(varValueServingWeightGrams);
$('#test8Data #varValueCalories').html(varValueCalories);
$('#test8Data #varValueTotalFat').html(varValueTotalFat);
$('#test8Data #varValueSatFat').html(varValueSatFat);
$('#test8Data #varValueTotalCarb').html(varValueTotalCarb);
$('#test8Data #varValueSugars').html(varValueSugars);
$('#test8Data #varValueFibers').html(varValueFibers);
$('#test8Data #varValueProteins').html(varValueProteins);
$('#test8Data #varValueSodium').html(varValueSodium);