public static void DrawAnomalyZones(this IPlotModelDrawer @this, IEnumerable <AnomalyZoneDefinition> anomalyZones) { OxyColor[] anomalyZoneColors = new OxyColor[] { // каждый охотник желает знать где сидит фазан OxyColor.FromAColor(100, OxyColors.Red), OxyColor.FromAColor(100, OxyColors.Orange), OxyColor.FromAColor(100, OxyColors.Yellow), OxyColor.FromAColor(100, OxyColors.Violet) }; int counter = 0; lock (@this.PlotModel.SyncRoot) { foreach (var anomalyZone in anomalyZones) { var color = anomalyZoneColors[counter % anomalyZoneColors.Length]; var timeAxisKey = @this.GetTimeAxisKey(); if (timeAxisKey != null) { double start = TimeSpanAxis.ToDouble(anomalyZone.StartTime); double end = TimeSpanAxis.ToDouble(anomalyZone.EndTime); var timeAxis = @this.PlotModel.GetAxis(timeAxisKey); var annotation = CreateAnomalyZoneForAxis(timeAxis, start, end, anomalyZone.Name); annotation.Fill = color; @this.PlotModel.Annotations.Add(annotation); } var blockNumberAxisKey = @this.GetBlockNumberAxisKey(); if (blockNumberAxisKey != null) { var blockNumberAxis = @this.PlotModel.GetAxis(blockNumberAxisKey); var annotation = CreateAnomalyZoneForAxis(blockNumberAxis, anomalyZone.StartBlock, anomalyZone.EndBlock, anomalyZone.Name); annotation.Fill = color; @this.PlotModel.Annotations.Add(annotation); } counter++; } } @this.PlotModel.InvalidatePlot(false); }
public static void SetTitle(this IPlotModelDrawer @this, string title) { @this.PlotModel.Title = title; }