@using MotoVaultPro.Helper @inject IConfigHelper config @inject ITranslationHelper translator @model MPGForVehicleByMonth @{ var barGraphColors = StaticHelper.GetBarChartColors(); var userConfig = config.GetUserConfig(User); var userLanguage = userConfig.UserLanguage; } @if (Model.CostData.Any(x => x.Cost > 0)) { var chartMax = Math.Ceiling(Model.CostData.Max(x => x.Cost)); var graphGrace = Decimal.ToInt32(Model.CostData.Max(x => x.Cost) - Model.CostData.Min(x => x.Cost)); var chartMin = Math.Floor(Model.CostData.Min(x => x.Cost) - graphGrace); if (graphGrace < 0 || chartMin < 0) { graphGrace = 0; chartMin = 0; } var stepSize = StaticHelper.CalculateNiceStepSize(chartMin, chartMax, 8); var remMin = stepSize > 0 ? chartMin % stepSize : 0; var cleanedMin = chartMin - remMin; if (remMin >= (stepSize / 2)) { cleanedMin += stepSize; } var remMax = stepSize > 0 ? chartMax % stepSize : 0; var cleanedMax = chartMax - remMax; if (remMax >= (stepSize / 2)) { cleanedMax += stepSize; } } else {

@translator.Translate(userLanguage,"No data found, insert/select some data to see visualizations here.")

}