public void SetGoogleChartConfigurationForGeospatialAreaPerformanceMeasure(ProjectFirmaModels.Models.PerformanceMeasure performanceMeasure, ProjectFirmaModels.Models.GeospatialArea geospatialArea)
        {
            // Google Chart Configuration
            if (performanceMeasure.GeospatialAreaPerformanceMeasureReportingPeriodTargets.Any() || performanceMeasure.GeospatialAreaPerformanceMeasureFixedTargets.Any())
            {
                foreach (var pfSubcategory in performanceMeasure.PerformanceMeasureSubcategories)
                {
                    var tempChartConfig = GoogleChartConfiguration.GetGoogleChartConfigurationFromJsonObject(pfSubcategory.ChartConfigurationJson);
                    tempChartConfig.SeriesType = "bars";
                    tempChartConfig.Series     =
                        performanceMeasure.HasGeospatialAreaTargets(geospatialArea) && performanceMeasure.HasTargets()
                            ? GoogleChartSeries.GetDefaultGoogleChartSeriesForChartsWithTwoTargets()
                            : GoogleChartSeries.GetDefaultGoogleChartSeriesForChartsWithTargets();

                    pfSubcategory.GeospatialAreaTargetChartConfigurationJson = JObject.FromObject(tempChartConfig).ToString();
                    pfSubcategory.GeospatialAreaTargetGoogleChartTypeID      = performanceMeasure.HasGeospatialAreaTargets(geospatialArea) ? GoogleChartType.ComboChart.GoogleChartTypeID : GoogleChartType.ColumnChart.GoogleChartTypeID;
                    if (performanceMeasure.CanBeChartedCumulatively)
                    {
                        var cumulativeChartConfigurationJson = GoogleChartConfiguration.GetGoogleChartConfigurationFromJsonObject(pfSubcategory.ChartConfigurationJson);
                        cumulativeChartConfigurationJson.SeriesType    = "bars";
                        pfSubcategory.CumulativeChartConfigurationJson = JObject.FromObject(cumulativeChartConfigurationJson).ToString();
                        pfSubcategory.CumulativeGoogleChartTypeID      = performanceMeasure.HasTargets() ? GoogleChartType.ComboChart.GoogleChartTypeID : GoogleChartType.ColumnChart.GoogleChartTypeID;
                    }
                }
            }
        }
 public GoogleChartColumn(string columnID, string columnLabel, string columnDataType, GoogleChartSeries googleChartSeries, string columnDataRole, GoogleChartProperty columnProperty)
 {
     ColumnID          = columnID;
     ColumnLabel       = columnLabel;
     ColumnDataType    = columnDataType;
     GoogleChartSeries = googleChartSeries;
     ColumnDataRole    = columnDataRole;
     ColumnProperty    = columnProperty;
 }
        public void SetGoogleChartConfigurationForPerformanceMeasure(
            ProjectFirmaModels.Models.PerformanceMeasure performanceMeasure,
            PerformanceMeasureTargetValueTypeEnum performanceMeasureTargetValueTypeEnum)
        {
            var geospatialAreasWithTargets = new List <ProjectFirmaModels.Models.GeospatialArea>();

            geospatialAreasWithTargets.AddRange(performanceMeasure.GeospatialAreaPerformanceMeasureFixedTargets.Select(x => x.GeospatialArea));
            geospatialAreasWithTargets.AddRange(performanceMeasure.GeospatialAreaPerformanceMeasureReportingPeriodTargets.Select(x => x.GeospatialArea));

            //Google Chart Configuration for the Performance Measure
            foreach (var pfSubcategory in performanceMeasure.PerformanceMeasureSubcategories)
            {
                var tempChartConfig = GoogleChartConfiguration.GetGoogleChartConfigurationFromJsonObject(pfSubcategory.ChartConfigurationJson);
                tempChartConfig.SeriesType = "bars";
                if (performanceMeasure.HasTargets())
                {
                    tempChartConfig.Series          = GoogleChartSeries.GetDefaultGoogleChartSeriesForChartsWithTargets();
                    pfSubcategory.GoogleChartTypeID = GoogleChartType.ComboChart.GoogleChartTypeID;
                }
                else
                {
                    tempChartConfig.Series          = null;
                    pfSubcategory.GoogleChartTypeID = GoogleChartType.ColumnChart.GoogleChartTypeID;
                }
                pfSubcategory.ChartConfigurationJson = JObject.FromObject(tempChartConfig).ToString();
                if (performanceMeasure.CanBeChartedCumulatively)
                {
                    var cumulativeChartConfigurationJson = GoogleChartConfiguration.GetGoogleChartConfigurationFromJsonObject(pfSubcategory.ChartConfigurationJson);
                    cumulativeChartConfigurationJson.SeriesType    = "bars";
                    pfSubcategory.CumulativeChartConfigurationJson = JObject.FromObject(cumulativeChartConfigurationJson).ToString();
                    pfSubcategory.CumulativeGoogleChartTypeID      = performanceMeasure.HasTargets() ? GoogleChartType.ComboChart.GoogleChartTypeID : GoogleChartType.ColumnChart.GoogleChartTypeID;
                }

                // We need to adjust the chart JSON for the the geospatial area as well if there are geospatial area targets for this performance measure by adding an additional line series to the configuration json
                if (geospatialAreasWithTargets.Any())
                {
                    var tempGeospatialChartConfig = GoogleChartConfiguration.GetGoogleChartConfigurationFromJsonObject(pfSubcategory.ChartConfigurationJson);
                    tempGeospatialChartConfig.SeriesType = "bars";
                    tempGeospatialChartConfig.Series     = performanceMeasure.HasTargets() ? GoogleChartSeries.GetDefaultGoogleChartSeriesForChartsWithTwoTargets() : GoogleChartSeries.GetDefaultGoogleChartSeriesForChartsWithTargets();
                    pfSubcategory.GeospatialAreaTargetChartConfigurationJson = JObject.FromObject(tempGeospatialChartConfig).ToString();
                    pfSubcategory.GeospatialAreaTargetGoogleChartTypeID      = GoogleChartType.ComboChart.GoogleChartTypeID;
                }
            }
        }
 public GoogleChartColumn(string columnID, string columnLabel, string columnDataType, GoogleChartSeries googleChartSeries)
     : this(columnID, columnLabel, columnDataType, googleChartSeries, null, null)
 {
 }