public ChartForGlobalEventsTimingAndActuations(GlobalGetDataTimingAndActuations globalGetDataTimingAndActuations, TimingAndActuationsOptions options) { var GlobalDataTimingAndActuations = globalGetDataTimingAndActuations; var Options = options; var orginalEndDate = Options.EndDate; var reportTimespan = Options.EndDate - Options.StartDate; var totalMinutesRounded = Math.Round(reportTimespan.TotalMinutes); if (totalMinutesRounded <= 121) // remove extra minute to timefrom defaults { Options.EndDate = Options.EndDate.AddMinutes(-1); } Chart = ChartFactory.CreateDefaultChart(Options); SetChartTitle(Options); SetGlobalEvents(GlobalDataTimingAndActuations, Options); SetYAxisLabels(Options); Options.EndDate = orginalEndDate; }
private void SetGlobalEvents(GlobalGetDataTimingAndActuations globalGetDataTimingAndActuations, TimingAndActuationsOptions options) { _yValue = 0.5; _dotSize = 1; if (options.DotAndBarSize > 0) { _dotSize = options.DotAndBarSize; } foreach (var globalCustomEventElement in globalGetDataTimingAndActuations.GlobalCustomEvents) { var globalEventsSeries = new Series { ChartType = SeriesChartType.Point, XValueType = ChartValueType.DateTime }; var globalCustomEvents = globalCustomEventElement.Value; if (globalCustomEvents.Count <= 0) { continue; } for (int i = 0; i < globalCustomEvents.Count; i++) { var p0 = globalEventsSeries.Points.AddXY(globalCustomEvents[i].Timestamp.ToOADate(), _yValue); globalEventsSeries.Points[p0].Color = Color.Transparent; globalEventsSeries.Points[p0].MarkerStyle = MarkerStyle.Triangle; globalEventsSeries.Points[p0].MarkerColor = Color.Black; globalEventsSeries.Points[p0].MarkerSize = _dotSize; } if (globalEventsSeries.Points.Count <= 0) { return; } globalEventsSeries.Name = globalCustomEventElement.Key; Chart.Series.Add(globalEventsSeries); _yValue += 1.0; } }