public PlotterForm(PlotStyle style, PlotScale scale, Stream inputStream) { _plotStyle = style; _plotScale = scale; Stream = inputStream; InitializeComponent(); }
/// <summary> /// /// </summary> /// <param name="dictionary"></param> /// <param name="ps">Default style for graph.</param> /// <param name="name">>Name of created graph.</param> /// <returns></returns> public ScatterSeries Add(Dictionary <string, double> dictionary, PlotStyle ps = PlotStyle.VerticalBars, string name = "") { var axis = ps == PlotStyle.HorisontalBars ? GetVerticalAxis() : GetHorizontalAxis(); if (axis.CustomTicksLabels == null) { axis.CustomTicksLabels = dictionary.Keys.ToArray(); } else { axis.CustomTicksLabels = axis.CustomTicksLabels.Concat(dictionary.Keys).Distinct().ToArray(); } axis.CustomTicks = axis.CustomTicksLabels.Select((key, i) => (double)i).ToArray(); axis.MinorTickNumber = 1; axis.MinorTickStyle = ps == PlotStyle.HorisontalBars ? TickStyle.Near : TickStyle.Far; axis.MajorTickStyle = TickStyle.None; ScatterSeries data = ps == PlotStyle.HorisontalBars ? new ScatterSeries(dictionary.Values, dictionary.Keys.Select(key => (double)Array.FindIndex(axis.CustomTicksLabels, e => e == key))) : new ScatterSeries(dictionary.Keys.Select(key => (double)Array.FindIndex(axis.CustomTicksLabels, e => e == key)), dictionary.Values); data.Name = name; int plotIndex = Data.Count(); PlotStyleApply(data, ps, plotIndex); this.Add(data); return(data); }
/// <summary> /// Initializes a new instance of the <see cref="RelevanceOfStrokeSection"/> class. /// </summary> /// <param name="transitions">The transitions</param> /// <param name="style">The style for the plots in this section</param> public RelevanceOfStrokeSection(Transitions transitions, PlotStyle style) { this.RelevanceOfStroke = new RelevanceOfStroke(transitions); this.style = style; this.PlotByStriker = this.PlotRelevanceOfStroke(); }
/// <summary> /// Create instance of <see cref="OMPlot.Data.ScatterSeries"/> and add it to plot. /// </summary> /// <param name="x">Collection of X values.</param> /// <param name="y">Collection of Y values.</param> /// <param name="ps">Default style for graph.</param> /// <param name="name">Name of created graph.</param> /// <returns>Instance of <see cref="OMPlot.Data.ScatterSeries"/></returns> public ScatterSeries Add(IEnumerable <double> x, IEnumerable <double> y, PlotStyle ps = PlotStyle.Lines, string name = "") { ScatterSeries data = new ScatterSeries(x, y, string.IsNullOrEmpty(name) ? "Plot" + Data.Count().ToString() : name); int plotIndex = Data.Count(); PlotStyleApply(data, ps, plotIndex); this.Add(data); return(data); }
/// <summary> /// Initializes a new instance of the <see cref="RallyLengthSection"/> class. /// </summary> /// <param name="match">The match.</param> /// <param name="style">The style for the plot</param> public RallyLengthSection(Match match, PlotStyle style) { this.style = style; this.match = match; this.Statistics = new RallyLengthStatistics(match); this.Plot = this.PlotLengths(); this.PlotByWinner = this.PlotLengthsByWinner(); }
/// <summary> /// Initializes a new instance of the <see cref="MatchDynamicsSection"/> class. /// </summary> /// <param name="match">The match.</param> /// <param name="style">The plot style.</param> public MatchDynamicsSection(Match match, PlotStyle style) { this.match = match; this.style = style; this.Dynamics = new MatchDynamics(match); this.OverallPlot = this.PlotOverallDynamics(); this.ByServerPlot = this.PlotByServerDynamics(); }
/// <summary> /// Create instance of <see cref="OMPlot.Data.LineSeries"/> and add it to plot. /// </summary> /// <param name="y">Collection of the values.</param> /// <param name="dx">Custom dX for the series.</param> /// <param name="x0">Custom start X value.</param> /// <param name="ps">Default style for graph.</param> /// <param name="name">Name of created graph.</param> /// <returns>Instance of <see cref="OMPlot.Data.LineSeries"/></returns> public LineSeries Add(IEnumerable <double> y, double dx, double x0, PlotStyle ps = PlotStyle.Lines, string name = "") { LineSeries data = new LineSeries(y, dx, x0); data.Name = string.IsNullOrEmpty(name) ? "Plot" + Data.Count().ToString() : name; int plotIndex = Data.Count(); PlotStyleApply(data, ps, plotIndex); this.Add(data); return(data); }
/// <summary> /// Generates a default report for a match. /// </summary> /// <param name="match">The match to generate the report for.</param> /// <returns>The generated report.</returns> public Report GenerateReport(Match match) { var plotStyle = new PlotStyle() { TextFont = "Calibri", TextSize = 10, TextColor = OxyColors.Black, BorderColor = OxyColors.DarkGray, GridlineColor = OxyColors.LightGray, FirstPlayerColor = OxyColor.Parse("#4F81BD"), SecondPlayerColor = OxyColor.Parse("#C0504D"), }; // TODO: Swap players! var report = new Report(); report.Sections.Add(new MetadataSection() { Subject = string.Format( "{0} {1}, {2} vs. {3}", match.Tournament, match.Round.ToString(), match.FirstPlayer.Name, match.SecondPlayer.Name), Title = "Table Tennis Performance Report", Author = "TODO" }); report.Sections.Add( new HeaderSection() { Headline = "Table Tennis Performance Report", Tournament = match.Tournament, Category = match.Category.ToString(), DisabilityClass = match.DisabilityClass.ToString(), Round = match.Round.ToString(), Date = match.DateTime }); report.Sections.Add(new BasicInformationSection(match)); report.Sections.Add(new RallyLengthSection(match, plotStyle)); report.Sections.Add(new ScoringProcessSection(match, plotStyle)); report.Sections.Add(new MatchDynamicsSection(match, plotStyle)); var transitionSection = new TransitionsSection(match); report.Sections.Add(transitionSection); report.Sections.Add(new TechnicalEfficiencySection(transitionSection.Transitions)); report.Sections.Add(new RelevanceOfStrokeSection(transitionSection.Transitions, plotStyle)); return report; }
private void PlotStyleApply(ScatterSeries data, PlotStyle ps, int plotIndex) { int colorIndex = plotIndex % defaultPlotColors.Length; data.LineColor = defaultPlotColors[colorIndex]; data.MarkColor = defaultPlotColors[colorIndex]; data.FillColor = defaultPlotColors[colorIndex]; data.BarFillColor = defaultPlotColors[colorIndex]; if (ps == PlotStyle.Lines || ps == PlotStyle.Splines) { int lineStyleIndex = (plotIndex - colorIndex) / defaultPlotColors.Length % defaultLineStyle.Length; data.LineStyle = defaultLineStyle[lineStyleIndex]; if (ps == PlotStyle.Splines) { data.Interpolation = Interpolation.Spline; } } else if (ps == PlotStyle.LinesMarkers || ps == PlotStyle.SplinesMarkers) { int markerStyleIndex = (plotIndex - colorIndex) / defaultPlotColors.Length % defaultMarkerStyle.Length; data.MarkStyle = defaultMarkerStyle[markerStyleIndex]; if (ps == PlotStyle.SplinesMarkers) { data.Interpolation = Interpolation.Spline; } } else if (ps == PlotStyle.Markers) { int markerStyleIndex = plotIndex % defaultMarkerStyle.Length; data.LineStyle = LineStyle.None; data.MarkStyle = defaultMarkerStyle[markerStyleIndex]; } else if (ps == PlotStyle.VerticalBars || ps == PlotStyle.HorisontalBars) { data.LineStyle = LineStyle.None; data.BarDuty = 0.7f; data.BarGrouping = true; data.BarStyle = ps == PlotStyle.HorisontalBars ? BarStyle.Horisontal : BarStyle.Vertical; } }
private IReportSection GetStrokeSection(string sectionName, PlotStyle plotStyle, Match match, object player, bool stepAround, int strokeNumber) { var sets = (IDictionary <string, List <Rally> >)Customization["sets"]; switch (sectionName) { case "steparound": case "side": return(new SideSection(plotStyle, strokeNumber, stepAround, sets, match, player)); case "spin": return(new SpinSection(plotStyle, sets, match, player)); case "technique": return(new TechniqueSection(plotStyle, strokeNumber, sets, match, player)); case "placement": return(new PlacementSection(strokeNumber, sets, match, player)); case "table": return(new LargeTableSection(strokeNumber, sets, match, player)); case "service": return(new LastStrokeServiceSection()); case "number": return(new StrokeNumberSection(plotStyle, strokeNumber, sets, match, player)); } return(null); }
private void AddStrokeSections(Report report, PlotStyle plotStyle, Match match, object player) { var statsNames = new[] { "service_stats", "return_stats", "third_stats", "fourth_stats", "last_stats", "all_stats" }; foreach (var n in statsNames) { var strokeStats = (List <string>)Customization[n]; if (strokeStats.Count > 0) { var headingNameAndNumber = GetStrokeStatsHeadingNameAndStrokeNr(n); report.Sections.Add(new StrokeStatsHeadingSection((string)headingNameAndNumber[0])); bool stepAround = strokeStats.Contains("steparound"); bool hasSideSection = false; foreach (var s in strokeStats) { var sec = GetStrokeSection(s, plotStyle, match, player, stepAround, (int)headingNameAndNumber[1]); if (sec is SideSection) { if (!hasSideSection) { report.Sections.Add(sec); } hasSideSection = true; } else { if (sec != null) { report.Sections.Add(sec); } } } } } }
/// <summary> /// AB trend 2 indicator /// </summary> /// <returns></returns> public Indicator.AbTrend2 ABTrend2(Data.IDataSeries input, Color backgroundcolorDn, Color backgroundcolorUp, bool colorAllBackgrounds, bool colorBackground, DashStyle dash1Style, Color downColor, double multiplier, int opacity, bool paintBars, int periodATR, int periodMedian, PlotStyle plot1Style, int plot1Width, bool showArrows, bool showStopLine, Color upColor) { if (InInitialize && input == null) throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method"); return _indicator.ABTrend2(input, backgroundcolorDn, backgroundcolorUp, colorAllBackgrounds, colorBackground, dash1Style, downColor, multiplier, opacity, paintBars, periodATR, periodMedian, plot1Style, plot1Width, showArrows, showStopLine, upColor); }
/// <summary> /// Initializes a new instance of the <see cref="ScoringProcessSection"/> class. /// </summary> /// <param name="match">The match</param> /// <param name="style">The style to use for the plot.</param> public ScoringProcessSection(Match match, PlotStyle style) { this.match = match; this.style = style; this.Plot = this.PlotScoringProcess(); }
private void ProbabilityToolStripMenuItem_Click(object sender, EventArgs e) { _plotStyle = PlotStyle.Probabilities; PlotResults(); }
private void SetPlotInfo(SuperCell superCell, PlotStyle thisPlotStyle) { currentCell = superCell; plotStyle = thisPlotStyle; fieldLineStyle = FieldLineStyle.None; miscInfo = new MiscInfo(); displayList = new List<Vector3d>(); extents = new double[] { double.MaxValue, double.MinValue, double.MaxValue, double.MinValue, double.MaxValue, double.MinValue }; up = new Vector3d(0.0, 1.0, 0.0); right = new Vector3d(1.0, 0.0, 0.0); miscInfo.planeNormal = Calculator.Num2TK(Calculator.CrossProduct(superCell.latticeVectors.Column(0), superCell.latticeVectors.Column(1))); miscInfo.pointOnPlane = Calculator.Num2TK(superCell.centroids.Row(0)); rotationLocked = false; Vector3d oldTarget = target; if (!isRunning) { target = new Vector3d(0.0, 0.0, 0.0); theta = 0.0; phi = -Math.PI / 2; } switch (plotStyle) { case PlotStyle.Molecules: string[] distinctTypes = superCell.types.Distinct().ToArray(); miscInfo.colorOrder = new Color4[superCell.types.Length]; miscInfo.colorList = new List<Color4>(); for (int i = 0; i < superCell.types.Length; i++) { int index = 0; while (true) { if (superCell.types[i] == distinctTypes[index]) break; index++; } miscInfo.colorOrder[i] = molColors[index]; } for (int i = 0; i < superCell.mols.Count; i++) { Vector3d myCentroid = Calculator.Num2TK(superCell.mols[i].centroid); for (int j = 0; j < superCell.bonds.GetLength(0); j++) { miscInfo.colorList.Add(miscInfo.colorOrder[superCell.bonds[j, 0]-1]); Vector3d atom = Calculator.Num2TK(superCell.mols[i].atoms.Row(superCell.bonds[j, 0] - 1)) + myCentroid; extents = Calculator.UpdateExtents(extents, atom); target += atom; displayList.Add(atom); miscInfo.colorList.Add(miscInfo.colorOrder[superCell.bonds[j, 1]-1]); atom = Calculator.Num2TK(superCell.mols[i].atoms.Row(superCell.bonds[j, 1] - 1)) + myCentroid; extents = Calculator.UpdateExtents(extents, atom); target += atom; displayList.Add(atom); } } break; case PlotStyle.Centers: for (int i = 0; i < superCell.centroids.RowCount; i++) { Vector3d centroid = Calculator.Num2TK(superCell.centroids.Row(i)); extents = Calculator.UpdateExtents(extents, centroid); target += centroid; displayList.Add(centroid); } break; case PlotStyle.Directions: GrabDirections(superCell,false); break; case PlotStyle.Curl: GrabDirections(superCell,true); break; } target /= (double)displayList.Count; if (!isRunning) { gameWidth = (extents[1] - extents[0]) * 1.1; gameHeight = (extents[3] - extents[2]) * 1.1; gameDepth = extents[5] - extents[4]; depthClipPlane = Math.Max(Math.Max(gameWidth, gameDepth), gameDepth); eye = new Vector3d(target.X, target.Y, depthClipPlane * 2.0); } else { target = oldTarget; UpdateView(); } r = (eye - target).Length; }
public void Plot(SuperCell superCell, PlotStyle plotStyle) { Pause(); SetPlotInfo(superCell, plotStyle); UnPause(); if (!isRunning) { runGameThread = new Thread(PlotInit); runGameThread.Start(); isRunning = true; } }
/// <summary> /// SuperTrend /// </summary> /// <returns></returns> public anaSuperTrendU11 anaSuperTrendU11(Data.IDataSeries input, int basePeriod, string confirmedDownTrend, string confirmedUpTrend, DashStyle dash0Style, DashStyle dash1Style, Color downColor, double multiplier, int opacity, PlotStyle plot0Style, int plot0Width, PlotStyle plot1Style, int plot1Width, string potentialDownTrend, string potentialUpTrend, int rangePeriod, int rearmTime, bool reverseIntraBar, bool showArrows, bool showPaintBars, bool showStopLine, bool soundAlert, anaSuperTrendU11BaseType thisBaseType, anaSuperTrendU11OffsetType thisOffsetType, anaSuperTrendU11VolaType thisRangeType, Color upColor) { if (cacheanaSuperTrendU11 != null) { for (int idx = 0; idx < cacheanaSuperTrendU11.Length; idx++) { if (cacheanaSuperTrendU11[idx].BasePeriod == basePeriod && cacheanaSuperTrendU11[idx].ConfirmedDownTrend == confirmedDownTrend && cacheanaSuperTrendU11[idx].ConfirmedUpTrend == confirmedUpTrend && cacheanaSuperTrendU11[idx].Dash0Style == dash0Style && cacheanaSuperTrendU11[idx].Dash1Style == dash1Style && cacheanaSuperTrendU11[idx].DownColor == downColor && Math.Abs(cacheanaSuperTrendU11[idx].Multiplier - multiplier) <= double.Epsilon && cacheanaSuperTrendU11[idx].Opacity == opacity && cacheanaSuperTrendU11[idx].Plot0Style == plot0Style && cacheanaSuperTrendU11[idx].Plot0Width == plot0Width && cacheanaSuperTrendU11[idx].Plot1Style == plot1Style && cacheanaSuperTrendU11[idx].Plot1Width == plot1Width && cacheanaSuperTrendU11[idx].PotentialDownTrend == potentialDownTrend && cacheanaSuperTrendU11[idx].PotentialUpTrend == potentialUpTrend && cacheanaSuperTrendU11[idx].RangePeriod == rangePeriod && cacheanaSuperTrendU11[idx].RearmTime == rearmTime && cacheanaSuperTrendU11[idx].ReverseIntraBar == reverseIntraBar && cacheanaSuperTrendU11[idx].ShowArrows == showArrows && cacheanaSuperTrendU11[idx].ShowPaintBars == showPaintBars && cacheanaSuperTrendU11[idx].ShowStopLine == showStopLine && cacheanaSuperTrendU11[idx].SoundAlert == soundAlert && cacheanaSuperTrendU11[idx].ThisBaseType == thisBaseType && cacheanaSuperTrendU11[idx].ThisOffsetType == thisOffsetType && cacheanaSuperTrendU11[idx].ThisRangeType == thisRangeType && cacheanaSuperTrendU11[idx].UpColor == upColor && cacheanaSuperTrendU11[idx].EqualsInput(input)) { return(cacheanaSuperTrendU11[idx]); } } } lock (checkanaSuperTrendU11) { checkanaSuperTrendU11.BasePeriod = basePeriod; basePeriod = checkanaSuperTrendU11.BasePeriod; checkanaSuperTrendU11.ConfirmedDownTrend = confirmedDownTrend; confirmedDownTrend = checkanaSuperTrendU11.ConfirmedDownTrend; checkanaSuperTrendU11.ConfirmedUpTrend = confirmedUpTrend; confirmedUpTrend = checkanaSuperTrendU11.ConfirmedUpTrend; checkanaSuperTrendU11.Dash0Style = dash0Style; dash0Style = checkanaSuperTrendU11.Dash0Style; checkanaSuperTrendU11.Dash1Style = dash1Style; dash1Style = checkanaSuperTrendU11.Dash1Style; checkanaSuperTrendU11.DownColor = downColor; downColor = checkanaSuperTrendU11.DownColor; checkanaSuperTrendU11.Multiplier = multiplier; multiplier = checkanaSuperTrendU11.Multiplier; checkanaSuperTrendU11.Opacity = opacity; opacity = checkanaSuperTrendU11.Opacity; checkanaSuperTrendU11.Plot0Style = plot0Style; plot0Style = checkanaSuperTrendU11.Plot0Style; checkanaSuperTrendU11.Plot0Width = plot0Width; plot0Width = checkanaSuperTrendU11.Plot0Width; checkanaSuperTrendU11.Plot1Style = plot1Style; plot1Style = checkanaSuperTrendU11.Plot1Style; checkanaSuperTrendU11.Plot1Width = plot1Width; plot1Width = checkanaSuperTrendU11.Plot1Width; checkanaSuperTrendU11.PotentialDownTrend = potentialDownTrend; potentialDownTrend = checkanaSuperTrendU11.PotentialDownTrend; checkanaSuperTrendU11.PotentialUpTrend = potentialUpTrend; potentialUpTrend = checkanaSuperTrendU11.PotentialUpTrend; checkanaSuperTrendU11.RangePeriod = rangePeriod; rangePeriod = checkanaSuperTrendU11.RangePeriod; checkanaSuperTrendU11.RearmTime = rearmTime; rearmTime = checkanaSuperTrendU11.RearmTime; checkanaSuperTrendU11.ReverseIntraBar = reverseIntraBar; reverseIntraBar = checkanaSuperTrendU11.ReverseIntraBar; checkanaSuperTrendU11.ShowArrows = showArrows; showArrows = checkanaSuperTrendU11.ShowArrows; checkanaSuperTrendU11.ShowPaintBars = showPaintBars; showPaintBars = checkanaSuperTrendU11.ShowPaintBars; checkanaSuperTrendU11.ShowStopLine = showStopLine; showStopLine = checkanaSuperTrendU11.ShowStopLine; checkanaSuperTrendU11.SoundAlert = soundAlert; soundAlert = checkanaSuperTrendU11.SoundAlert; checkanaSuperTrendU11.ThisBaseType = thisBaseType; thisBaseType = checkanaSuperTrendU11.ThisBaseType; checkanaSuperTrendU11.ThisOffsetType = thisOffsetType; thisOffsetType = checkanaSuperTrendU11.ThisOffsetType; checkanaSuperTrendU11.ThisRangeType = thisRangeType; thisRangeType = checkanaSuperTrendU11.ThisRangeType; checkanaSuperTrendU11.UpColor = upColor; upColor = checkanaSuperTrendU11.UpColor; if (cacheanaSuperTrendU11 != null) { for (int idx = 0; idx < cacheanaSuperTrendU11.Length; idx++) { if (cacheanaSuperTrendU11[idx].BasePeriod == basePeriod && cacheanaSuperTrendU11[idx].ConfirmedDownTrend == confirmedDownTrend && cacheanaSuperTrendU11[idx].ConfirmedUpTrend == confirmedUpTrend && cacheanaSuperTrendU11[idx].Dash0Style == dash0Style && cacheanaSuperTrendU11[idx].Dash1Style == dash1Style && cacheanaSuperTrendU11[idx].DownColor == downColor && Math.Abs(cacheanaSuperTrendU11[idx].Multiplier - multiplier) <= double.Epsilon && cacheanaSuperTrendU11[idx].Opacity == opacity && cacheanaSuperTrendU11[idx].Plot0Style == plot0Style && cacheanaSuperTrendU11[idx].Plot0Width == plot0Width && cacheanaSuperTrendU11[idx].Plot1Style == plot1Style && cacheanaSuperTrendU11[idx].Plot1Width == plot1Width && cacheanaSuperTrendU11[idx].PotentialDownTrend == potentialDownTrend && cacheanaSuperTrendU11[idx].PotentialUpTrend == potentialUpTrend && cacheanaSuperTrendU11[idx].RangePeriod == rangePeriod && cacheanaSuperTrendU11[idx].RearmTime == rearmTime && cacheanaSuperTrendU11[idx].ReverseIntraBar == reverseIntraBar && cacheanaSuperTrendU11[idx].ShowArrows == showArrows && cacheanaSuperTrendU11[idx].ShowPaintBars == showPaintBars && cacheanaSuperTrendU11[idx].ShowStopLine == showStopLine && cacheanaSuperTrendU11[idx].SoundAlert == soundAlert && cacheanaSuperTrendU11[idx].ThisBaseType == thisBaseType && cacheanaSuperTrendU11[idx].ThisOffsetType == thisOffsetType && cacheanaSuperTrendU11[idx].ThisRangeType == thisRangeType && cacheanaSuperTrendU11[idx].UpColor == upColor && cacheanaSuperTrendU11[idx].EqualsInput(input)) { return(cacheanaSuperTrendU11[idx]); } } } anaSuperTrendU11 indicator = new anaSuperTrendU11(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.BasePeriod = basePeriod; indicator.ConfirmedDownTrend = confirmedDownTrend; indicator.ConfirmedUpTrend = confirmedUpTrend; indicator.Dash0Style = dash0Style; indicator.Dash1Style = dash1Style; indicator.DownColor = downColor; indicator.Multiplier = multiplier; indicator.Opacity = opacity; indicator.Plot0Style = plot0Style; indicator.Plot0Width = plot0Width; indicator.Plot1Style = plot1Style; indicator.Plot1Width = plot1Width; indicator.PotentialDownTrend = potentialDownTrend; indicator.PotentialUpTrend = potentialUpTrend; indicator.RangePeriod = rangePeriod; indicator.RearmTime = rearmTime; indicator.ReverseIntraBar = reverseIntraBar; indicator.ShowArrows = showArrows; indicator.ShowPaintBars = showPaintBars; indicator.ShowStopLine = showStopLine; indicator.SoundAlert = soundAlert; indicator.ThisBaseType = thisBaseType; indicator.ThisOffsetType = thisOffsetType; indicator.ThisRangeType = thisRangeType; indicator.UpColor = upColor; Indicators.Add(indicator); indicator.SetUp(); anaSuperTrendU11[] tmp = new anaSuperTrendU11[cacheanaSuperTrendU11 == null ? 1 : cacheanaSuperTrendU11.Length + 1]; if (cacheanaSuperTrendU11 != null) { cacheanaSuperTrendU11.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheanaSuperTrendU11 = tmp; return(indicator); } }
public TechniqueSection(PlotStyle plotStyle, int strokeNumber, IDictionary <string, List <Rally> > sets, Match match, object p) { Debug.WriteLine("New Technique section"); if (strokeNumber == 1) { base.GetImageBitmapFrames(strokeNumber, sets, match, p, typeof(ServiceTechniqueStatisticsGridView)); } else { base.GetImageBitmapFrames(strokeNumber, sets, match, p, typeof(TechniqueStatisticsGridView)); Debug.WriteLine("Got TechniqueGridView image"); foreach (var set in sets.Keys) { if (sets[set].Count > 0) { var statistics = new TechniqueStatistics(match, p, sets[set], strokeNumber); Debug.WriteLine("Got TechniqueStatistics (set={0})", args: set); PlotModel plot = plotStyle.CreatePlot(); plot.LegendOrientation = LegendOrientation.Horizontal; plot.LegendPlacement = LegendPlacement.Outside; plot.LegendPosition = LegendPosition.BottomCenter; plot.PlotAreaBorderThickness = new OxyThickness(1, 0, 0, 1); var categoryAxis = new CategoryAxis(); categoryAxis.Position = AxisPosition.Bottom; categoryAxis.MinorStep = 1; var linearAxis = new LinearAxis(); linearAxis.Position = AxisPosition.Left; linearAxis.MinorStep = 1; linearAxis.MajorStep = 4; linearAxis.AbsoluteMinimum = 0; linearAxis.MaximumPadding = 0.06; linearAxis.MinimumPadding = 0; var barSeries1 = new ColumnSeries(); var barSeries2 = new ColumnSeries(); barSeries1.IsStacked = true; barSeries2.IsStacked = true; barSeries1.StrokeThickness = 1; barSeries2.StrokeThickness = 1; barSeries1.Title = Properties.Resources.section_stroke_won; barSeries2.Title = Properties.Resources.section_stroke_lost; barSeries1.LabelPlacement = LabelPlacement.Inside; barSeries2.LabelPlacement = LabelPlacement.Inside; barSeries1.LabelMargin = 4; barSeries2.LabelMargin = 4; barSeries1.LabelFormatString = "{0}"; barSeries2.LabelFormatString = "{0}"; int categoriesCount = 0; foreach (var tec in statistics.GetType().GetProperties()) { Models.Util.Enums.Stroke.TechniqueBasic tb; if (Enum.TryParse(tec.Name, out tb)) { categoriesCount += (int)tec.GetValue(statistics) > 0 ? 1 : 0; } } bool useShortCatNames = categoriesCount > 4; int categoryNr = 0; if (statistics.Push > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", useShortCatNames ? Properties.Resources.technique_push_short : Properties.Resources.section_technique_push, statistics.Push)); barSeries1.Items.Add(new ColumnItem(statistics.PushWon, categoryNr)); var pushLost = statistics.Push - statistics.PushWon; if (pushLost > 0) { barSeries2.Items.Add(new ColumnItem(pushLost, categoryNr)); } categoryNr++; } if (statistics.Flip > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", useShortCatNames ? Properties.Resources.technique_flip_short : Properties.Resources.section_technique_flip, statistics.Flip)); barSeries1.Items.Add(new ColumnItem(statistics.FlipWon, categoryNr)); var flipLost = statistics.Flip - statistics.FlipWon; if (flipLost > 0) { barSeries2.Items.Add(new ColumnItem(flipLost, categoryNr)); } categoryNr++; } if (statistics.Topspin > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", useShortCatNames ? Properties.Resources.technique_topspin_short : Properties.Resources.section_technique_topspin, statistics.Topspin)); barSeries1.Items.Add(new ColumnItem(statistics.TopspinWon, categoryNr)); var topspinLost = statistics.Topspin - statistics.TopspinWon; if (topspinLost > 0) { barSeries2.Items.Add(new ColumnItem(topspinLost, categoryNr)); } categoryNr++; } if (statistics.Block > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", useShortCatNames ? Properties.Resources.technique_block_short : Properties.Resources.section_technique_block, statistics.Block)); barSeries1.Items.Add(new ColumnItem(statistics.BlockWon, categoryNr)); var blockLost = statistics.Block - statistics.BlockWon; if (blockLost > 0) { barSeries2.Items.Add(new ColumnItem(blockLost, categoryNr)); } categoryNr++; } if (statistics.Counter > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", useShortCatNames ? Properties.Resources.technique_counter_short : Properties.Resources.section_technique_counter, statistics.Counter)); barSeries1.Items.Add(new ColumnItem(statistics.CounterWon, categoryNr)); var counterLost = statistics.Counter - statistics.CounterWon; if (counterLost > 0) { barSeries2.Items.Add(new ColumnItem(counterLost, categoryNr)); } categoryNr++; } if (statistics.Smash > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", useShortCatNames ? Properties.Resources.technique_smash_short : Properties.Resources.section_technique_smash, statistics.Smash)); barSeries1.Items.Add(new ColumnItem(statistics.SmashWon, categoryNr)); var smashLost = statistics.Smash - statistics.SmashWon; if (smashLost > 0) { barSeries2.Items.Add(new ColumnItem(smashLost, categoryNr)); } categoryNr++; } if (statistics.Lob > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", useShortCatNames ? Properties.Resources.technique_lob_short : Properties.Resources.section_technique_lob, statistics.Lob)); barSeries1.Items.Add(new ColumnItem(statistics.LobWon, categoryNr)); var lobLost = statistics.Lob - statistics.LobWon; if (lobLost > 0) { barSeries2.Items.Add(new ColumnItem(lobLost, categoryNr)); } categoryNr++; } if (statistics.Chop > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", useShortCatNames ? Properties.Resources.technique_chop_short : Properties.Resources.section_technique_chop, statistics.Chop)); barSeries1.Items.Add(new ColumnItem(statistics.ChopWon, categoryNr)); var chopLost = statistics.Chop - statistics.ChopWon; if (chopLost > 0) { barSeries2.Items.Add(new ColumnItem(chopLost, categoryNr)); } categoryNr++; } if (statistics.Special > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", useShortCatNames ? Properties.Resources.technique_special_short : Properties.Resources.section_technique_special, statistics.Special)); barSeries1.Items.Add(new ColumnItem(statistics.SpecialWon, categoryNr)); var specialLost = statistics.Special - statistics.SpecialWon; if (specialLost > 0) { barSeries2.Items.Add(new ColumnItem(specialLost, categoryNr)); } categoryNr++; } if (statistics.Miscellaneous > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", useShortCatNames ? Properties.Resources.technique_miscellaneous_short : Properties.Resources.section_technique_miscellaneous, statistics.Miscellaneous)); barSeries1.Items.Add(new ColumnItem(statistics.MiscellaneousWon, categoryNr)); var miscellaneousLost = statistics.Miscellaneous - statistics.MiscellaneousWon; if (miscellaneousLost > 0) { barSeries2.Items.Add(new ColumnItem(miscellaneousLost, categoryNr)); } categoryNr++; } plot.Series.Add(barSeries1); plot.Series.Add(barSeries2); plot.Axes.Add(categoryAxis); plot.Axes.Add(linearAxis); var setTitle = GetSetTitleString(set); var sectionImages = new List <object>() { plot }; if (ExistingStatisticsImageBitmapFrames.ContainsKey(setTitle)) { sectionImages.Add(ExistingStatisticsImageBitmapFrames[setTitle]); } else { sectionImages.Add(null); } ExistingStatisticsImageBitmapFrames[setTitle] = sectionImages; Debug.WriteLine("{2} for stroke {0} of set {1} ready.", GetStrokeNumberString(strokeNumber), set, SectionName); } } } }
/// <summary> /// AB trend 2 indicator /// </summary> /// <returns></returns> public Indicator.AbTrend2 ABTrend2(Data.IDataSeries input, Color backgroundcolorDn, Color backgroundcolorUp, bool colorAllBackgrounds, bool colorBackground, DashStyle dash1Style, Color downColor, double multiplier, int opacity, bool paintBars, int periodATR, int periodMedian, PlotStyle plot1Style, int plot1Width, bool showArrows, bool showStopLine, Color upColor) { if (InInitialize && input == null) { throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method"); } return(_indicator.ABTrend2(input, backgroundcolorDn, backgroundcolorUp, colorAllBackgrounds, colorBackground, dash1Style, downColor, multiplier, opacity, paintBars, periodATR, periodMedian, plot1Style, plot1Width, showArrows, showStopLine, upColor)); }
public Indicator.AbTrend2 ABTrend2(Color backgroundcolorDn, Color backgroundcolorUp, bool colorAllBackgrounds, bool colorBackground, DashStyle dash1Style, Color downColor, double multiplier, int opacity, bool paintBars, int periodATR, int periodMedian, PlotStyle plot1Style, int plot1Width, bool showArrows, bool showStopLine, Color upColor) { return(_indicator.ABTrend2(Input, backgroundcolorDn, backgroundcolorUp, colorAllBackgrounds, colorBackground, dash1Style, downColor, multiplier, opacity, paintBars, periodATR, periodMedian, plot1Style, plot1Width, showArrows, showStopLine, upColor)); }
/// <summary> /// AB trend 2 indicator /// </summary> /// <returns></returns> public AbTrend2 ABTrend2(Data.IDataSeries input, Color backgroundcolorDn, Color backgroundcolorUp, bool colorAllBackgrounds, bool colorBackground, DashStyle dash1Style, Color downColor, double multiplier, int opacity, bool paintBars, int periodATR, int periodMedian, PlotStyle plot1Style, int plot1Width, bool showArrows, bool showStopLine, Color upColor) { if (cacheABTrend2 != null) { for (int idx = 0; idx < cacheABTrend2.Length; idx++) { if (cacheABTrend2[idx].BackgroundcolorDn == backgroundcolorDn && cacheABTrend2[idx].BackgroundcolorUp == backgroundcolorUp && cacheABTrend2[idx].ColorAllBackgrounds == colorAllBackgrounds && cacheABTrend2[idx].ColorBackground == colorBackground && cacheABTrend2[idx].Dash1Style == dash1Style && cacheABTrend2[idx].DownColor == downColor && Math.Abs(cacheABTrend2[idx].Multiplier - multiplier) <= double.Epsilon && cacheABTrend2[idx].Opacity == opacity && cacheABTrend2[idx].PaintBars == paintBars && cacheABTrend2[idx].PeriodAtr == periodATR && cacheABTrend2[idx].PeriodMedian == periodMedian && cacheABTrend2[idx].Plot1Style == plot1Style && cacheABTrend2[idx].Plot1Width == plot1Width && cacheABTrend2[idx].ShowArrows == showArrows && cacheABTrend2[idx].ShowStopLine == showStopLine && cacheABTrend2[idx].UpColor == upColor && cacheABTrend2[idx].EqualsInput(input)) { return(cacheABTrend2[idx]); } } } lock (checkABTrend2) { checkABTrend2.BackgroundcolorDn = backgroundcolorDn; backgroundcolorDn = checkABTrend2.BackgroundcolorDn; checkABTrend2.BackgroundcolorUp = backgroundcolorUp; backgroundcolorUp = checkABTrend2.BackgroundcolorUp; checkABTrend2.ColorAllBackgrounds = colorAllBackgrounds; colorAllBackgrounds = checkABTrend2.ColorAllBackgrounds; checkABTrend2.ColorBackground = colorBackground; colorBackground = checkABTrend2.ColorBackground; checkABTrend2.Dash1Style = dash1Style; dash1Style = checkABTrend2.Dash1Style; checkABTrend2.DownColor = downColor; downColor = checkABTrend2.DownColor; checkABTrend2.Multiplier = multiplier; multiplier = checkABTrend2.Multiplier; checkABTrend2.Opacity = opacity; opacity = checkABTrend2.Opacity; checkABTrend2.PaintBars = paintBars; paintBars = checkABTrend2.PaintBars; checkABTrend2.PeriodAtr = periodATR; periodATR = checkABTrend2.PeriodAtr; checkABTrend2.PeriodMedian = periodMedian; periodMedian = checkABTrend2.PeriodMedian; checkABTrend2.Plot1Style = plot1Style; plot1Style = checkABTrend2.Plot1Style; checkABTrend2.Plot1Width = plot1Width; plot1Width = checkABTrend2.Plot1Width; checkABTrend2.ShowArrows = showArrows; showArrows = checkABTrend2.ShowArrows; checkABTrend2.ShowStopLine = showStopLine; showStopLine = checkABTrend2.ShowStopLine; checkABTrend2.UpColor = upColor; upColor = checkABTrend2.UpColor; if (cacheABTrend2 != null) { for (int idx = 0; idx < cacheABTrend2.Length; idx++) { if (cacheABTrend2[idx].BackgroundcolorDn == backgroundcolorDn && cacheABTrend2[idx].BackgroundcolorUp == backgroundcolorUp && cacheABTrend2[idx].ColorAllBackgrounds == colorAllBackgrounds && cacheABTrend2[idx].ColorBackground == colorBackground && cacheABTrend2[idx].Dash1Style == dash1Style && cacheABTrend2[idx].DownColor == downColor && Math.Abs(cacheABTrend2[idx].Multiplier - multiplier) <= double.Epsilon && cacheABTrend2[idx].Opacity == opacity && cacheABTrend2[idx].PaintBars == paintBars && cacheABTrend2[idx].PeriodAtr == periodATR && cacheABTrend2[idx].PeriodMedian == periodMedian && cacheABTrend2[idx].Plot1Style == plot1Style && cacheABTrend2[idx].Plot1Width == plot1Width && cacheABTrend2[idx].ShowArrows == showArrows && cacheABTrend2[idx].ShowStopLine == showStopLine && cacheABTrend2[idx].UpColor == upColor && cacheABTrend2[idx].EqualsInput(input)) { return(cacheABTrend2[idx]); } } } AbTrend2 indicator = new AbTrend2(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.BackgroundcolorDn = backgroundcolorDn; indicator.BackgroundcolorUp = backgroundcolorUp; indicator.ColorAllBackgrounds = colorAllBackgrounds; indicator.ColorBackground = colorBackground; indicator.Dash1Style = dash1Style; indicator.DownColor = downColor; indicator.Multiplier = multiplier; indicator.Opacity = opacity; indicator.PaintBars = paintBars; indicator.PeriodAtr = periodATR; indicator.PeriodMedian = periodMedian; indicator.Plot1Style = plot1Style; indicator.Plot1Width = plot1Width; indicator.ShowArrows = showArrows; indicator.ShowStopLine = showStopLine; indicator.UpColor = upColor; Indicators.Add(indicator); indicator.SetUp(); AbTrend2[] tmp = new AbTrend2[cacheABTrend2 == null ? 1 : cacheABTrend2.Length + 1]; if (cacheABTrend2 != null) { cacheABTrend2.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheABTrend2 = tmp; return(indicator); } }
public StrokeNumberSection(PlotStyle plotStyle, int strokeNumber, IDictionary <string, List <Models.Rally> > sets, Models.Match match, object p) { NumberPlots = new List <PlotModel>(); foreach (var set in sets.Keys) { if (sets[set].Count > 0) { var statistics = new TechniqueStatistics(match, p, sets[set], strokeNumber); PlotModel plot = plotStyle.CreatePlot(); plot.Title = GetSetTitleString(set); plot.TitleFontSize = 16; plot.LegendOrientation = LegendOrientation.Horizontal; plot.LegendPlacement = LegendPlacement.Outside; plot.LegendPosition = LegendPosition.BottomCenter; plot.PlotAreaBorderThickness = new OxyThickness(1, 0, 0, 1); var categoryAxis = new CategoryAxis(); categoryAxis.Position = AxisPosition.Bottom; categoryAxis.MinorStep = 1; var linearAxis = new LinearAxis(); linearAxis.Position = AxisPosition.Left; linearAxis.MinorStep = 1; linearAxis.MajorStep = 4; linearAxis.AbsoluteMinimum = 0; linearAxis.MaximumPadding = 0.06; linearAxis.MinimumPadding = 0; var techniqueToSeries = new Dictionary <string, ColumnSeries>(); int index = 0; foreach (var number in statistics.NumberToTechniqueCountDict.Keys) { var numberCount = 0; foreach (var count in statistics.NumberToTechniqueCountDict[number].Values) { numberCount += count; } if (numberCount > 0) { categoryAxis.Labels.Add(string.Format("{0} ({1})", number, numberCount)); foreach (var technique in statistics.NumberToTechniqueCountDict[number].Keys) { var techniqueCount = statistics.NumberToTechniqueCountDict[number][technique]; if (techniqueCount > 0) { ColumnSeries series; if (techniqueToSeries.ContainsKey(technique)) { series = techniqueToSeries[technique]; } else { series = GetNewSeries(technique); techniqueToSeries[technique] = series; } series.Items.Add(new ColumnItem(techniqueCount, categoryIndex: index)); } } index++; } } foreach (var series in techniqueToSeries.Values) { plot.Series.Add(series); } plot.Axes.Add(categoryAxis); plot.Axes.Add(linearAxis); NumberPlots.Add(plot); Debug.WriteLine("{2} for stroke {0} of set {1} ready.", GetStrokeNumberString(strokeNumber), set, SectionName); } } }
/// <summary> /// SuperTrend /// </summary> /// <returns></returns> public Indicator.anaSuperTrendU11 anaSuperTrendU11(Data.IDataSeries input, int basePeriod, string confirmedDownTrend, string confirmedUpTrend, DashStyle dash0Style, DashStyle dash1Style, Color downColor, double multiplier, int opacity, PlotStyle plot0Style, int plot0Width, PlotStyle plot1Style, int plot1Width, string potentialDownTrend, string potentialUpTrend, int rangePeriod, int rearmTime, bool reverseIntraBar, bool showArrows, bool showPaintBars, bool showStopLine, bool soundAlert, anaSuperTrendU11BaseType thisBaseType, anaSuperTrendU11OffsetType thisOffsetType, anaSuperTrendU11VolaType thisRangeType, Color upColor) { if (InInitialize && input == null) { throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method"); } return(_indicator.anaSuperTrendU11(input, basePeriod, confirmedDownTrend, confirmedUpTrend, dash0Style, dash1Style, downColor, multiplier, opacity, plot0Style, plot0Width, plot1Style, plot1Width, potentialDownTrend, potentialUpTrend, rangePeriod, rearmTime, reverseIntraBar, showArrows, showPaintBars, showStopLine, soundAlert, thisBaseType, thisOffsetType, thisRangeType, upColor)); }
/// <summary> /// SuperTrend /// </summary> /// <returns></returns> public anaSuperTrendU11 anaSuperTrendU11(int basePeriod, string confirmedDownTrend, string confirmedUpTrend, DashStyle dash0Style, DashStyle dash1Style, Color downColor, double multiplier, int opacity, PlotStyle plot0Style, int plot0Width, PlotStyle plot1Style, int plot1Width, string potentialDownTrend, string potentialUpTrend, int rangePeriod, int rearmTime, bool reverseIntraBar, bool showArrows, bool showPaintBars, bool showStopLine, bool soundAlert, anaSuperTrendU11BaseType thisBaseType, anaSuperTrendU11OffsetType thisOffsetType, anaSuperTrendU11VolaType thisRangeType, Color upColor) { return(anaSuperTrendU11(Input, basePeriod, confirmedDownTrend, confirmedUpTrend, dash0Style, dash1Style, downColor, multiplier, opacity, plot0Style, plot0Width, plot1Style, plot1Width, potentialDownTrend, potentialUpTrend, rangePeriod, rearmTime, reverseIntraBar, showArrows, showPaintBars, showStopLine, soundAlert, thisBaseType, thisOffsetType, thisRangeType, upColor)); }
public SideSection(PlotStyle plotStyle, int strokeNr, bool stepAround, IDictionary <string, List <Rally> > sets, Match match, object player) { SidePlots = new List <PlotModel>(); HasStepAround = stepAround; bool multipleSets = sets.Count > 1; foreach (var set in sets.Keys) { if (sets[set].Count > 0) { var statistics = new SideStatistics(match, player, strokeNr, sets[set]); int dataMax = Enumerable.Max(new int[] { statistics.Backhand, statistics.BackhandStepAround, statistics.Forehand, statistics.ForehandStepAround, statistics.NotAnalysed }); PlotModel plot = plotStyle.CreatePlot(); plot.LegendOrientation = LegendOrientation.Horizontal; plot.LegendPlacement = LegendPlacement.Outside; plot.LegendPosition = LegendPosition.BottomCenter; plot.Title = GetSetTitleString(set); plot.TitleFontSize = 16; plot.PlotAreaBorderThickness = new OxyThickness(1, 0, 0, 1); var categoryAxis1 = new CategoryAxis(); categoryAxis1.Position = AxisPosition.Left; categoryAxis1.MinorStep = 1; var linearAxis1 = new LinearAxis(); linearAxis1.Position = AxisPosition.Bottom; linearAxis1.MajorStep = Math.Ceiling(dataMax / 4d); linearAxis1.MinorStep = linearAxis1.MajorStep / 4d; linearAxis1.AbsoluteMinimum = 0; linearAxis1.MaximumPadding = 0.06; linearAxis1.MinimumPadding = 0; var wonSeries = new BarSeries(); var lostSeries = new BarSeries(); wonSeries.IsStacked = true; lostSeries.IsStacked = true; wonSeries.StrokeThickness = 1; lostSeries.StrokeThickness = 1; wonSeries.Title = Properties.Resources.section_stroke_won; lostSeries.Title = Properties.Resources.section_stroke_lost; wonSeries.LabelPlacement = LabelPlacement.Inside; lostSeries.LabelPlacement = LabelPlacement.Inside; wonSeries.LabelMargin = 8; lostSeries.LabelMargin = 8; wonSeries.LabelFormatString = "{0}"; lostSeries.LabelFormatString = "{0}"; int categoryNr = 0; if (statistics.NotAnalysed > 0) { categoryAxis1.Labels.Add(string.Format("{0} ({1})", Properties.Resources.stat_not_analysed, statistics.NotAnalysed)); wonSeries.Items.Add(new BarItem(statistics.NotAnalysedWon, categoryNr)); var notAnalysedLost = statistics.NotAnalysed - statistics.NotAnalysedWon; if (notAnalysedLost > 0) { lostSeries.Items.Add(new BarItem(notAnalysedLost, categoryNr)); } categoryNr++; } if (stepAround) { categoryAxis1.Labels.Add(string.Format("{0} ({1})", multipleSets ? Properties.Resources.side_backhand_steparound_short : Properties.Resources.side_backhand_steparound, statistics.BackhandStepAround)); wonSeries.Items.Add(new BarItem(statistics.BackhandStepAroundWon, categoryNr)); var bhSaLost = statistics.BackhandStepAround - statistics.BackhandStepAroundWon; if (bhSaLost > 0) { lostSeries.Items.Add(new BarItem(bhSaLost, categoryNr)); } categoryNr++; } categoryAxis1.Labels.Add(string.Format("{0} ({1})", multipleSets ? Properties.Resources.side_backhand_short : Properties.Resources.side_backhand, statistics.Backhand)); wonSeries.Items.Add(new BarItem(statistics.BackhandWon, categoryNr)); var noSpinLost = statistics.Backhand - statistics.BackhandWon; if (noSpinLost > 0) { lostSeries.Items.Add(new BarItem(noSpinLost, categoryNr)); } categoryNr++; if (stepAround) { categoryAxis1.Labels.Add(string.Format("{0} ({1})", multipleSets ? Properties.Resources.side_forehand_steparound_short : Properties.Resources.side_forehand_steparound, statistics.ForehandStepAround)); wonSeries.Items.Add(new BarItem(statistics.ForehandStepAroundWon, categoryNr)); var fhSaLost = statistics.ForehandStepAround - statistics.ForehandStepAroundWon; if (fhSaLost > 0) { lostSeries.Items.Add(new BarItem(fhSaLost, categoryNr)); } categoryNr++; } categoryAxis1.Labels.Add(string.Format("{0} ({1})", multipleSets ? Properties.Resources.side_forehand_short : Properties.Resources.side_forehand, statistics.Forehand)); wonSeries.Items.Add(new BarItem(statistics.ForehandWon, categoryNr)); var spinUpLost = statistics.Forehand - statistics.ForehandWon; if (spinUpLost > 0) { lostSeries.Items.Add(new BarItem(spinUpLost, categoryNr)); } categoryNr++; plot.Series.Add(wonSeries); plot.Series.Add(lostSeries); plot.Axes.Add(categoryAxis1); plot.Axes.Add(linearAxis1); SidePlots.Add(plot); Debug.WriteLine("{2} for stroke {0} of set {1} ready.", GetStrokeNumberString(strokeNr), set, SectionName); } } }
public SpinSection(PlotStyle plotStyle, IDictionary <string, List <Rally> > sets, Match match, object player) { SpinPlots = new List <PlotModel>(); foreach (var set in sets.Keys) { if (sets[set].Count > 0) { var statistics = new SpinStatistics(match, player, sets[set]); var dataMax = new[] { statistics.NoSpin, statistics.SpinDown, statistics.SpinUp, statistics.NotAnalysed }.Max(); var plot = plotStyle.CreatePlot(); plot.LegendOrientation = LegendOrientation.Horizontal; plot.LegendPlacement = LegendPlacement.Outside; plot.LegendPosition = LegendPosition.BottomCenter; plot.Title = GetSetTitleString(set); plot.TitleFontSize = 16; plot.PlotAreaBorderThickness = new OxyThickness(1, 0, 0, 1); var categoryAxis1 = new CategoryAxis { Position = AxisPosition.Left, MinorStep = 1 }; var linearAxis1 = new LinearAxis { Position = AxisPosition.Bottom, MajorStep = Math.Max(Math.Ceiling(dataMax / 4d), 1) }; linearAxis1.MinorStep = linearAxis1.MajorStep / 4d; linearAxis1.AbsoluteMinimum = 0; linearAxis1.MaximumPadding = 0.06; linearAxis1.MinimumPadding = 0; var barSeries1 = new BarSeries(); var barSeries2 = new BarSeries(); barSeries1.IsStacked = true; barSeries2.IsStacked = true; barSeries1.StrokeThickness = 1; barSeries2.StrokeThickness = 1; barSeries1.Title = Properties.Resources.section_stroke_won; barSeries2.Title = Properties.Resources.section_stroke_lost; barSeries1.LabelPlacement = LabelPlacement.Inside; barSeries2.LabelPlacement = LabelPlacement.Inside; barSeries1.LabelMargin = 8; barSeries2.LabelMargin = 8; barSeries1.LabelFormatString = "{0}"; barSeries2.LabelFormatString = "{0}"; int categoryNr = 0; if (statistics.NotAnalysed > 0) { categoryAxis1.Labels.Add(string.Format("{0} ({1})", Properties.Resources.section_spin_hidden, statistics.NotAnalysed)); barSeries1.Items.Add(new BarItem(statistics.NotAnalysedWon, categoryNr)); var notAnalysedLost = statistics.NotAnalysed - statistics.NotAnalysedWon; if (notAnalysedLost > 0) { barSeries2.Items.Add(new BarItem(notAnalysedLost, categoryNr)); } categoryNr++; } categoryAxis1.Labels.Add(string.Format("{0} ({1})", Properties.Resources.section_spin_down, statistics.SpinDown)); barSeries1.Items.Add(new BarItem(statistics.SpinDownWon, categoryNr)); var spinDownLost = statistics.SpinDown - statistics.SpinDownWon; if (spinDownLost > 0) { barSeries2.Items.Add(new BarItem(spinDownLost, categoryNr)); } categoryNr++; categoryAxis1.Labels.Add(string.Format("{0} ({1})", Properties.Resources.section_spin_no, statistics.NoSpin)); barSeries1.Items.Add(new BarItem(statistics.NoSpinWon, categoryNr)); var noSpinLost = statistics.NoSpin - statistics.NoSpinWon; if (noSpinLost > 0) { barSeries2.Items.Add(new BarItem(noSpinLost, categoryNr)); } categoryNr++; categoryAxis1.Labels.Add(string.Format("{0} ({1})", Properties.Resources.section_spin_up, statistics.SpinUp)); barSeries1.Items.Add(new BarItem(statistics.SpinUpWon, categoryNr)); var spinUpLost = statistics.SpinUp - statistics.SpinUpWon; if (spinUpLost > 0) { barSeries2.Items.Add(new BarItem(spinUpLost, categoryNr)); } plot.Series.Add(barSeries1); plot.Series.Add(barSeries2); plot.Axes.Add(categoryAxis1); plot.Axes.Add(linearAxis1); SpinPlots.Add(plot); Debug.WriteLine("{1} for stroke 1 of set {0} ready.", set, SectionName); } } }
public SlopeEnhancedOp SlopeEnhancedOp(ISeries <double> input, int period, int detrendPeriod, int smooth, bool detrend, InputSeriesType inputType, NormType normType, Brush colorUp, Brush colorDown, PlotStyle lineStyle) { if (cacheSlopeEnhancedOp != null) { for (int idx = 0; idx < cacheSlopeEnhancedOp.Length; idx++) { if (cacheSlopeEnhancedOp[idx] != null && cacheSlopeEnhancedOp[idx].Period == period && cacheSlopeEnhancedOp[idx].DetrendPeriod == detrendPeriod && cacheSlopeEnhancedOp[idx].Smooth == smooth && cacheSlopeEnhancedOp[idx].Detrend == detrend && cacheSlopeEnhancedOp[idx].InputType == inputType && cacheSlopeEnhancedOp[idx].NormType == normType && cacheSlopeEnhancedOp[idx].ColorUp == colorUp && cacheSlopeEnhancedOp[idx].ColorDown == colorDown && cacheSlopeEnhancedOp[idx].LineStyle == lineStyle && cacheSlopeEnhancedOp[idx].EqualsInput(input)) { return(cacheSlopeEnhancedOp[idx]); } } } return(CacheIndicator <SlopeEnhancedOp>(new SlopeEnhancedOp() { Period = period, DetrendPeriod = detrendPeriod, Smooth = smooth, Detrend = detrend, InputType = inputType, NormType = normType, ColorUp = colorUp, ColorDown = colorDown, LineStyle = lineStyle }, input, ref cacheSlopeEnhancedOp)); }
public void PlotWithFieldLines(SuperCell superCell, PlotStyle plotStyle, FieldLineStyle fieldLines, double density) { Pause(); SetPlotInfo(superCell, plotStyle); this.fieldLineStyle = fieldLines; fieldLineList = new List<FieldLine>(); fieldLineList.Add(new FieldLine()); if (fieldLines == FieldLineStyle.Full) GrabAllFieldLines(); UnPause(); if (!isRunning) { runGameThread = new Thread(PlotInit); runGameThread.Start(); isRunning = true; } }
public Indicators.SlopeEnhancedOp SlopeEnhancedOp(ISeries <double> input, int period, int detrendPeriod, int smooth, bool detrend, InputSeriesType inputType, NormType normType, Brush colorUp, Brush colorDown, PlotStyle lineStyle) { return(indicator.SlopeEnhancedOp(input, period, detrendPeriod, smooth, detrend, inputType, normType, colorUp, colorDown, lineStyle)); }
private void NumbersToolStripMenuItem_Click(object sender, EventArgs e) { _plotStyle = PlotStyle.Numbers; PlotResults(); }
/// <summary> /// AB trend 2 indicator /// </summary> /// <returns></returns> public AbTrend2 ABTrend2(Data.IDataSeries input, Color backgroundcolorDn, Color backgroundcolorUp, bool colorAllBackgrounds, bool colorBackground, DashStyle dash1Style, Color downColor, double multiplier, int opacity, bool paintBars, int periodATR, int periodMedian, PlotStyle plot1Style, int plot1Width, bool showArrows, bool showStopLine, Color upColor) { if (cacheABTrend2 != null) for (int idx = 0; idx < cacheABTrend2.Length; idx++) if (cacheABTrend2[idx].BackgroundcolorDn == backgroundcolorDn && cacheABTrend2[idx].BackgroundcolorUp == backgroundcolorUp && cacheABTrend2[idx].ColorAllBackgrounds == colorAllBackgrounds && cacheABTrend2[idx].ColorBackground == colorBackground && cacheABTrend2[idx].Dash1Style == dash1Style && cacheABTrend2[idx].DownColor == downColor && Math.Abs(cacheABTrend2[idx].Multiplier - multiplier) <= double.Epsilon && cacheABTrend2[idx].Opacity == opacity && cacheABTrend2[idx].PaintBars == paintBars && cacheABTrend2[idx].PeriodAtr == periodATR && cacheABTrend2[idx].PeriodMedian == periodMedian && cacheABTrend2[idx].Plot1Style == plot1Style && cacheABTrend2[idx].Plot1Width == plot1Width && cacheABTrend2[idx].ShowArrows == showArrows && cacheABTrend2[idx].ShowStopLine == showStopLine && cacheABTrend2[idx].UpColor == upColor && cacheABTrend2[idx].EqualsInput(input)) return cacheABTrend2[idx]; lock (checkABTrend2) { checkABTrend2.BackgroundcolorDn = backgroundcolorDn; backgroundcolorDn = checkABTrend2.BackgroundcolorDn; checkABTrend2.BackgroundcolorUp = backgroundcolorUp; backgroundcolorUp = checkABTrend2.BackgroundcolorUp; checkABTrend2.ColorAllBackgrounds = colorAllBackgrounds; colorAllBackgrounds = checkABTrend2.ColorAllBackgrounds; checkABTrend2.ColorBackground = colorBackground; colorBackground = checkABTrend2.ColorBackground; checkABTrend2.Dash1Style = dash1Style; dash1Style = checkABTrend2.Dash1Style; checkABTrend2.DownColor = downColor; downColor = checkABTrend2.DownColor; checkABTrend2.Multiplier = multiplier; multiplier = checkABTrend2.Multiplier; checkABTrend2.Opacity = opacity; opacity = checkABTrend2.Opacity; checkABTrend2.PaintBars = paintBars; paintBars = checkABTrend2.PaintBars; checkABTrend2.PeriodAtr = periodATR; periodATR = checkABTrend2.PeriodAtr; checkABTrend2.PeriodMedian = periodMedian; periodMedian = checkABTrend2.PeriodMedian; checkABTrend2.Plot1Style = plot1Style; plot1Style = checkABTrend2.Plot1Style; checkABTrend2.Plot1Width = plot1Width; plot1Width = checkABTrend2.Plot1Width; checkABTrend2.ShowArrows = showArrows; showArrows = checkABTrend2.ShowArrows; checkABTrend2.ShowStopLine = showStopLine; showStopLine = checkABTrend2.ShowStopLine; checkABTrend2.UpColor = upColor; upColor = checkABTrend2.UpColor; if (cacheABTrend2 != null) for (int idx = 0; idx < cacheABTrend2.Length; idx++) if (cacheABTrend2[idx].BackgroundcolorDn == backgroundcolorDn && cacheABTrend2[idx].BackgroundcolorUp == backgroundcolorUp && cacheABTrend2[idx].ColorAllBackgrounds == colorAllBackgrounds && cacheABTrend2[idx].ColorBackground == colorBackground && cacheABTrend2[idx].Dash1Style == dash1Style && cacheABTrend2[idx].DownColor == downColor && Math.Abs(cacheABTrend2[idx].Multiplier - multiplier) <= double.Epsilon && cacheABTrend2[idx].Opacity == opacity && cacheABTrend2[idx].PaintBars == paintBars && cacheABTrend2[idx].PeriodAtr == periodATR && cacheABTrend2[idx].PeriodMedian == periodMedian && cacheABTrend2[idx].Plot1Style == plot1Style && cacheABTrend2[idx].Plot1Width == plot1Width && cacheABTrend2[idx].ShowArrows == showArrows && cacheABTrend2[idx].ShowStopLine == showStopLine && cacheABTrend2[idx].UpColor == upColor && cacheABTrend2[idx].EqualsInput(input)) return cacheABTrend2[idx]; AbTrend2 indicator = new AbTrend2(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.BackgroundcolorDn = backgroundcolorDn; indicator.BackgroundcolorUp = backgroundcolorUp; indicator.ColorAllBackgrounds = colorAllBackgrounds; indicator.ColorBackground = colorBackground; indicator.Dash1Style = dash1Style; indicator.DownColor = downColor; indicator.Multiplier = multiplier; indicator.Opacity = opacity; indicator.PaintBars = paintBars; indicator.PeriodAtr = periodATR; indicator.PeriodMedian = periodMedian; indicator.Plot1Style = plot1Style; indicator.Plot1Width = plot1Width; indicator.ShowArrows = showArrows; indicator.ShowStopLine = showStopLine; indicator.UpColor = upColor; Indicators.Add(indicator); indicator.SetUp(); AbTrend2[] tmp = new AbTrend2[cacheABTrend2 == null ? 1 : cacheABTrend2.Length + 1]; if (cacheABTrend2 != null) cacheABTrend2.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheABTrend2 = tmp; return indicator; } }
public PlotterForm(PlotStyle style, PlotScale scale) { _plotStyle = style; _plotScale = scale; InitializeComponent(); }
public Indicator.AbTrend2 ABTrend2(Color backgroundcolorDn, Color backgroundcolorUp, bool colorAllBackgrounds, bool colorBackground, DashStyle dash1Style, Color downColor, double multiplier, int opacity, bool paintBars, int periodATR, int periodMedian, PlotStyle plot1Style, int plot1Width, bool showArrows, bool showStopLine, Color upColor) { return _indicator.ABTrend2(Input, backgroundcolorDn, backgroundcolorUp, colorAllBackgrounds, colorBackground, dash1Style, downColor, multiplier, opacity, paintBars, periodATR, periodMedian, plot1Style, plot1Width, showArrows, showStopLine, upColor); }
/// <summary> /// Generates a customized report for a match. /// </summary> /// <param name="match">The match to generate the report for.</param> /// <returns>The generated report.</returns> public Report GenerateReport(Match match) { var firstPlayerColor = _matchPlayerToColorConverter.Convert(MatchPlayer.First, typeof(Color), null, System.Globalization.CultureInfo.CurrentCulture); var secondPlayerColor = _matchPlayerToColorConverter.Convert(MatchPlayer.Second, typeof(Color), null, System.Globalization.CultureInfo.CurrentCulture); var plotStyle = new PlotStyle() { TextFont = "Calibri", TextSize = 10, TextColor = OxyColors.Black, BorderColor = OxyColors.DarkGray, GridlineColor = OxyColors.LightGray, FirstPlayerColor = OxyColor.Parse(firstPlayerColor.ToString()), SecondPlayerColor = OxyColor.Parse(secondPlayerColor.ToString()) }; var report = new Report(); if (Abort) { return(null); } report.Sections.Add(new MetadataSection() { Subject = $"{match.Tournament} {match.Round.ToString()}, {match.FirstPlayer.Name} vs. {match.SecondPlayer.Name}", Title = Properties.Resources.report_title, Author = "TUM - Fakultät für Sport- und Gesundheitswissenschaft" }); report.Sections.Add( new HeaderSection { Headline = Properties.Resources.report_header_headline, Tournament = match.Tournament ?? Properties.Resources.report_header_default_tournament, Category = match.Category.ToString() ?? Properties.Resources.report_header_default_tournament, DisabilityClass = (match.DisabilityClass.ToString() == null) ? Properties.Resources.report_header_default_tournament : ((match.DisabilityClass.ToString() == "NoClass") ? "" : match.DisabilityClass.ToString()), Round = match.Round.ToString() ?? Properties.Resources.report_header_default_round, Date = match.DateTime }); report.Sections.Add(new PartSection(Properties.Resources.section_part_general, PartSection.PartType.General)); report.Sections.Add(new BasicInformationSection(match)); report.Sections.Add(new ScoringProcessSection(match, plotStyle)); if (Abort) { return(null); } var transitionSection = new TransitionsSection(match); if (((List <string>)Customization["general"]).Contains("rallylength")) { report.Sections.Add(new RallyLengthSection(match, plotStyle)); } if (((List <string>)Customization["general"]).Contains("matchdynamics")) { report.Sections.Add(new MatchDynamicsSection(match, plotStyle)); } if (((List <string>)Customization["general"]).Contains("transitionmatrix")) { report.Sections.Add(transitionSection); } if (((List <string>)Customization["general"]).Contains("techefficiency")) { report.Sections.Add(new TechnicalEfficiencySection(transitionSection.Transitions)); } if (Abort) { return(null); } foreach (var p in (List <object>)Customization["players"]) { if (Abort) { return(null); } if (p is Player) { // add sections for requested players (1/2) report.Sections.Add(new PartSection(Properties.Resources.section_part_player, PartSection.PartType.Player) { Player = p as Player }); var sectionsCount = report.Sections.Count; AddStrokeSections(report, plotStyle, match, p); if (sectionsCount == report.Sections.Count) { report.Sections.Add(new SectionEmptyWarningSection(p as Player)); } } else if (p is List <Player> ) { // aggregate all stats for both players } } foreach (var sec in report.Sections) { if (sec is LargeTableSection) { report.Sections.Add(new PartSection(Properties.Resources.part_appendix, PartSection.PartType.Appendix)); report.Sections.Add(new TableLegendSection()); break; } } return(report); }
/// <summary> /// Create instance of <see cref="OMPlot.Data.LineSeries"/> with default X0 and add it to plot. /// </summary> /// <param name="y">Collection of the values.</param> /// <param name="dx">Custom dX for the series.</param> /// <param name="ps">Default style for graph.</param> /// <param name="name">Name of created graph.</param> /// <returns>Instance of <see cref="OMPlot.Data.LineSeries"/></returns> public LineSeries Add(IEnumerable <double> y, double dx, PlotStyle ps = PlotStyle.Lines, string name = "") { return(this.Add(y, dx, 0, ps, name)); }