protected override bool OnBubbleEvent(object sender, EventArgs args) { var handled = false; if (args is CommandEventArgs) { var commandArgs = args as CommandEventArgs; if (commandArgs.CommandName == FleetStatusChart.RedirectToCarSearch) { var parametersToTransfer = generalParams.GetParameterDictionary(); var barClicked = TopicTranslation.GetAvailabilityTopicFromDescription(commandArgs.CommandArgument.ToString()); List<string> moveTypes; List<string> opStatuses; using (var dataAccess = new BaseDataAccess()) { moveTypes = dataAccess.GetMovementTypesList().Select(d => d.Value).ToList(); opStatuses = dataAccess.GetOperationalStatusList().Select(d => d.Value).ToList(); } var opStatusString = string.Join(",", opStatuses); var moveTypeString = string.Join(",", moveTypes); var excludeOverdue = string.Empty; switch (barClicked) { case AvailabilityTopic.TotalFleet: break; case AvailabilityTopic.Cu: opStatusString = "2"; break; case AvailabilityTopic.Ha: opStatusString = "4"; break; case AvailabilityTopic.Hl: opStatusString = "5"; break; case AvailabilityTopic.Ll: opStatusString = "6"; break; case AvailabilityTopic.Nc: opStatusString = "8"; break; case AvailabilityTopic.Pl: opStatusString = "9"; break; case AvailabilityTopic.Tc: opStatusString = "16"; break; case AvailabilityTopic.Sv: opStatusString = "14"; break; case AvailabilityTopic.Ws: opStatusString = "19"; break; case AvailabilityTopic.OperationalFleet: opStatusString = "1,7,18,15,3,10,11,17,12,13"; break; case AvailabilityTopic.Bd: opStatusString = "1"; break; case AvailabilityTopic.Mm: opStatusString = "7"; break; case AvailabilityTopic.Tw: opStatusString = "18"; break; case AvailabilityTopic.Tb: opStatusString = "15"; break; case AvailabilityTopic.Fs: opStatusString = "3"; break; case AvailabilityTopic.Rl: opStatusString = "10"; break; case AvailabilityTopic.Rp: opStatusString = "11"; break; case AvailabilityTopic.Tn: opStatusString = "17"; break; case AvailabilityTopic.AvailableFleet: opStatusString = "12,13"; break; case AvailabilityTopic.Idle: opStatusString = "12"; moveTypeString = string.Join(",", moveTypes.Where(d => d != "10")); break; case AvailabilityTopic.Su: opStatusString = "13"; break; case AvailabilityTopic.Overdue: opStatusString = "12"; moveTypeString = "10"; excludeOverdue = "-1"; break; case AvailabilityTopic.OnRent: opStatusString = "12"; moveTypeString = "10"; excludeOverdue = "1"; break; case AvailabilityTopic.Utilization: break; case AvailabilityTopic.UtilizationInclOverdue: break; default: throw new ArgumentOutOfRangeException(); } parametersToTransfer[DictionaryParameter.OperationalStatuses] = opStatusString; parametersToTransfer[DictionaryParameter.MovementTypes] = moveTypeString; parametersToTransfer[DictionaryParameter.ExcludeOverdue] = excludeOverdue; Session[FleetStatusSessionParameters] = parametersToTransfer; Response.Redirect("~/App.Site/Availability/CarSearch/CarSearch.aspx"); } handled = true; } return handled; }
private void BuildWaterfallChart() { var ca = new ChartArea { Name = "Total Fleet Area" }; var pos = new ElementPosition { Width = ShowLegend ? 70 : 90, Height = 90, X = 0, Y = 5 }; ca.Position = pos; ca.AxisX.MajorGrid.Enabled = false; //ca.AxisX.CustomLabels.Add(new CustomLabel()); ca.AxisX.Interval = 2; //ca.AxisX.LabelStyle.Angle = -45; ca.AxisY.MajorGrid.Enabled = true; var ls = new LabelStyle { Format = "#,#" }; ca.AxisY.LabelStyle = ls; ca.AxisY.MajorGrid.LineColor = Color.LightGray; //ca.InnerPlotPosition.Width = 55; chrtFleetStatus.ChartAreas.Add(ca); var totalFleet = 0.0; foreach (var cd in GraphInformation.SeriesData) { var cs = new Series(cd.SeriesName) { ChartType = SeriesChartType.RangeColumn , Color = cd.GraphColour , XValueType = ChartValueType.String , YValuesPerPoint = 2 }; //cs["DrawSideBySide"] = "false"; cs["DrawingStyle"] = "Emboss"; if (TodaysData) { cs.PostBackValue = "BarClick/" + cd.SeriesName; } cs.IsValueShownAsLabel = GraphInformation.ShowLabelSeriesNames.Contains(cd.SeriesName); cs.LabelFormat = "#,#"; //cs.Label = cd.SeriesName; //cs.LabelAngle = -45; cs.ToolTip = "#SERIESNAME #CUSTOMPROPERTY(SIZE)"; cs.Points.AddXY(cd.SeriesName, cd.Yvalue.Cast <object>().ToArray()); //cs.Label = string.Format("{0:#,#}", cd.Yvalue[0] - cd.Yvalue[1]); //cs.LabelAngle = -45; cs.AxisLabel = cd.SeriesName; //cs.Points.AddXY(cd.SeriesName, cd.Yvalue[0]); var size = cd.Yvalue[0] - cd.Yvalue[1]; var availTopic = TopicTranslation.GetAvailabilityTopicFromDescription(cd.SeriesName); if (availTopic == AvailabilityTopic.TotalFleet) { totalFleet = cd.Yvalue[0]; } cs.Points[0]["SIZE"] = string.Format("{0:#,#}", size); cs["PixelPointWidth"] = "400"; chrtFleetStatus.Series.Add(cs); var imageLocation = cd.Displayed ? Checkedboximagelocation : Uncheckedboximagelocation; var legendItem = new LegendItem { Name = "Legend Item" }; var legendCell = new LegendCell { CellType = LegendCellType.Image, Image = imageLocation, Name = "Cell1", Margins = { Left = 15, Right = 15 }, PostBackValue = "LegendClick/" + cd.SeriesName }; var seriesHidden = GraphInformation.HiddenSeriesNames.Contains(cd.SeriesName); var legendCell2Colour = cd.GraphColour;//seriesHidden ? MarsColours.ChartLegendValuesHidden : cd.GraphColour; legendItem.Cells.Add(legendCell); legendCell = new LegendCell { Name = "Cell2", Text = cd.SeriesName, ForeColor = legendCell2Colour, Alignment = ContentAlignment.MiddleLeft }; legendItem.Cells.Add(legendCell); legendCell = new LegendCell { Name = "Cell3", Text = string.Format("{0:#,0}", size), ForeColor = legendCell2Colour, Font = new Font("Tahoma", 9), Alignment = ContentAlignment.MiddleRight, //PostBackValue = "LegendShowLabels/" + cd.SeriesName }; legendItem.Cells.Add(legendCell); legendCell = new LegendCell { Name = "Cell4", Text = string.Format("{0:p}", (size / totalFleet)), ForeColor = legendCell2Colour, Font = new Font("Tahoma", 9), Alignment = ContentAlignment.MiddleRight, }; legendItem.Cells.Add(legendCell); chrtFleetStatus.Legends["RightLegend"].CustomItems.Add(legendItem); if (cd.Displayed == false) { cs.IsVisibleInLegend = false; cs.Enabled = false; } } var slideLegendItem = new LegendItem { Name = "SlideButton" }; var slideLegendCell = new LegendCell { Name = "Cell4", Alignment = ContentAlignment.TopRight, PostBackValue = ShowLegend ? "HideLegend" : "ShowLegend", CellType = LegendCellType.Image, Image = ShowLegend ? "~/App.Images/hideRightIcon.gif" : "~/App.Images/hideLeftIcon.gif", }; slideLegendItem.Cells.Add(slideLegendCell); chrtFleetStatus.Legends["SlideLegend"].CustomItems.Add(slideLegendItem); }