public FileResult WIPCosts()
        {
            var InventoryCostData = new InventoryData(InventoryCostGroup.WIP, 10);
            InventoryCostData.CollectionDataName = "WIP";
            var InventoryCostChart = new InventoryChart(InventoryChartType.Performance, InventoryCostData, "WIP");

            return (File(InventoryCostChart.chartStream.GetBuffer(), @"image/png"));
        }
        public FileResult CostByWarehouse()
        {
            var InventoryCostData = new InventoryData(InventoryCostGroup.Warehouse, 10);
            InventoryCostData.CollectionDataName = "Current";
            var InventoryCostChart = new InventoryChart(InventoryChartType.Performance, InventoryCostData, "Inventory By Warehouse");

            return (File(InventoryCostChart.chartStream.GetBuffer(), @"image/png"));
        }
        public FileResult CostByInventoryType()
        {
            var InventoryCostData = new InventoryData(InventoryCostGroup.InventoryType, 10);
            InventoryCostData.AlignSeriesDataSetsByDate();
            InventoryCostData.CollectionDataName = "Current";
            var InventoryCostChart = new InventoryChart(InventoryChartType.Performance, InventoryCostData, "Inventory By Source");

            return (File(InventoryCostChart.chartStream.GetBuffer(), @"image/png"));
        }
        public InventoryChart(InventoryChartType InventoryChartType, InventoryData InventoryData, string Title)
        {
            chart = new Chart();
            chart.Width = 700;
            chart.Height = 300;
            chart.BackColor = Color.FromArgb(211, 223, 240);
            chart.BorderlineDashStyle = ChartDashStyle.Solid;
            chart.BackSecondaryColor = Color.White;
            chart.BackGradientStyle = GradientStyle.TopBottom;
            chart.BorderlineWidth = 1;
            chart.BorderlineColor = Color.FromArgb(26, 59, 105);
            chart.RenderType = RenderType.BinaryStreaming;
            chart.BorderSkin.SkinStyle = BorderSkinStyle.Emboss;
            chart.AntiAliasing = AntiAliasingStyles.All;
            chart.TextAntiAliasingQuality = TextAntiAliasingQuality.Normal;

            chart.Titles.Add(CreateTitle(Title));
            chart.Palette = ChartColorPalette.BrightPastel;
            chart.PaletteCustomColors = Settings.GetChartColorPaletteColors(chart.Palette);
            //chart.ApplyPaletteColors();
            switch (InventoryData.InventoryCostGroup)
            {
                case InventoryCostGroup.InventoryType:
                    chart.Legends.Add(CreateLegend());
                    for (int intCounter = 0; intCounter < InventoryData.SeriesDataSets.Count; intCounter++)
                        chart.Series.Add(CreatePerformanceSeries(InventoryData.SeriesDataSets[intCounter], SeriesChartType.Line, InventoryData.SeriesDataSets[intCounter][0].InventoryType));
                    break;
                case InventoryCostGroup.Warehouse:
                    chart.Legends.Add(CreateLegend());
                    for (int intCounter = 0; intCounter < InventoryData.SeriesDataSets.Count; intCounter++)
                        chart.Series.Add(CreatePerformanceSeries(InventoryData.SeriesDataSets[intCounter], SeriesChartType.Line, InventoryData.SeriesDataSets[intCounter][0].Warehouse));
                    break;
                case InventoryCostGroup.Purchased:
                case InventoryCostGroup.Manufactured:
                case InventoryCostGroup.WIP:
                    chart.Series.Add(CreatePerformanceSeries(InventoryData.CollectionData, SeriesChartType.Line, InventoryData.CollectionDataName));
                    break;
                case InventoryCostGroup.None:
                    chart.Legends.Add(CreateLegend());
                    switch (InventoryChartType)
                    {
                        case InventoryChartType.CompareByWarehouse:
                            for (int intCounter = 0; intCounter < InventoryData.SeriesDataSets.Count; intCounter++)
                                chart.Series.Add(CreateSeries(InventoryData.SeriesDataSets[intCounter], SeriesChartType.Column, "InventoryType", chart.PaletteCustomColors[intCounter], InventoryData.SeriesDataSets[intCounter][0].Warehouse));
                            break;
                        case InventoryChartType.CompareByInventoryType:
                            for (int intCounter = 0; intCounter < InventoryData.SeriesDataSets.Count; intCounter++)
                                chart.Series.Add(CreateSeries(InventoryData.SeriesDataSets[intCounter], SeriesChartType.Column, "Warehouse", chart.PaletteCustomColors[intCounter], InventoryData.SeriesDataSets[intCounter][0].InventoryType));
                            break;
                    }
                    break;
            }
            chart.ChartAreas.Add(CreateChartArea());

            chartStream = new MemoryStream();
            chart.SaveImage(chartStream);
        }
        public FileResult CostSourcesByWarehouse()
        {
            var InventoryCostData = new InventoryData(InventoryCostGroup.None, 1);
            InventoryCostData.CollectionDataName = "Comparison";
            InventoryCostData.PopulateSeriesDataSetsByWarehouse();
            InventoryCostData.AlignSeriesDataSetsByInventoryType();
            var InventoryCostChart = new InventoryChart(InventoryChartType.CompareByWarehouse, InventoryCostData, "Warehouse Inventory By Type");

            return (File(InventoryCostChart.chartStream.GetBuffer(), @"image/png"));
        }