public void LoadLine(string Caption, Decimal[] Points) { PlotLine line = new PlotLine(Caption); line.Points = Points.Cast <object>().ToArray(); this.acl.AddPlotLine(line); }
public void LoadLine(string Caption, string[] Points) { PlotLine line = new PlotLine(Caption); line.Points = Points; this.acl.AddPlotLine(line); }
// Draw a line into a texture2D void CreateLine(Texture2D tex, Dictionary <float, float> vals, Color col, float xScale, float yScale) { PlotLine curve = new PlotLine(vals); //FloatCurve curve = new FloatCurve(); //foreach (var item in vals) { // curve.Add(item.Key * xScale, item.Value * yScale); //tex.SetPixel((int)(xScale*item.Key), (int)(yScale*item.Value), col); //} Utils.Log(String.Format("[ProfilingUI]: xScale: {0} \nyScale: {1}", xScale.ToString(), yScale.ToString())); for (int i = 1; i < tex.width - 1; i++) { int y1 = Mathf.Clamp((int)(curve.Evaluate(i / xScale) * yScale), 0, tex.height - 1); tex.SetPixel((int)(i), y1, col); tex.SetPixel((int)(i + 1), y1, col); tex.SetPixel((int)(i - 1), y1, col); tex.SetPixel((int)(i), y1 + 1, col); tex.SetPixel((int)(i + 1), y1 + 1, col); tex.SetPixel((int)(i - 1), y1 + 1, col); tex.SetPixel((int)(i), y1 - 1, col); tex.SetPixel((int)(i + 1), y1 - 1, col); tex.SetPixel((int)(i - 1), y1 - 1, col); } }
protected override void OnCalculate() { int signal = 0; //Bars[0].IsGrowing && if ((Bars[0].TailBottom / Bars[0].Range) > (this.Percentage / 100.0)) { signal = 1; if (this.ShowArrows) { AddChartArrowUp("ArrowLong_PinBar" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].Low, this.ColorArrowLongSignal); } } else if ((Bars[0].TailTop / Bars[0].Range) > (this.Percentage / 100.0)) { signal = -1; if (this.ShowArrows) { AddChartArrowDown("ArrowShort_PinBar" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].High, this.ColorArrowShortSignal); } } if (ShowIndicatorBox) { PlotLine.Set(signal); } PlotColors[0][0] = this.Plot0Color; OutputDescriptors[0].PenStyle = this.Dash0Style; OutputDescriptors[0].Pen.Width = this.Plot0Width; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: void addLineErrorbars(Object[] params) throws JasymcaException internal virtual void addLineErrorbars(object[] @params) { if (!Hold_b) { reset(); } if (@params.Length < 3) { throw new JasymcaException("At least 3 arguments required."); } PlotLine line = new PlotLine(this); double[] x = (double[])@params[0]; line.lineMaxx = Math.Max(max(x), maxx); line.lineMinx = Math.Min(min(x), minx); double[] y = (double[])@params[1]; line.lineMaxy = Math.Max(max(y), maxy); line.lineMiny = Math.Min(min(y), miny); if (x.Length != y.Length) { throw new JasymcaException("X and Y must be same length"); } line.setPoints(x, y); double[] el = (double[])@params[2]; double[] eu = el; if (el.Length != y.Length) { throw new JasymcaException("Errors and Y must be same length"); } int i = 3; if (@params.Length > 3 && !(@params[3] is string)) { eu = (double[])@params[3]; if (eu.Length != y.Length) { throw new JasymcaException("Errors and Y must be same length"); } i++; } line.eu = eu; line.el = el; maxx = Math.Max(line.lineMaxx, maxx); minx = Math.Min(line.lineMinx, minx); maxy = Math.Max(line.lineMaxy, maxy); miny = Math.Min(line.lineMiny, miny); if (i < @params.Length && (@params[i] is string)) { line.LineAttributes = @params[i].ToString(); i++; } PlotLines.Add(line); setMinMax(); repaint(); }
public LinePlotContainer(DataChart source, PlotLine line) : base(source) { Plot = new LinePlot(); Plot.DataSource = line.Data; Plot.AbscissaData = source.XAxis; Plot.OrdinateData = line.Expression; this.Expression = line.Expression; plotInterface = Plot; PlotYAxis = new Axis(); source.Plot.Add(Plot, XAxisPosition.Bottom, YAxisPosition.Left, 0, null, PlotYAxis); }
public PointPlotContainer(DataChart <T> source, PlotLine line) : base(source) { Plot = new NPlot.PointPlot(); Plot.DataSource = line.Data; Plot.AbscissaData = source.XAxis; Plot.OrdinateData = line.Expression; Plot.Marker.Type = Marker.MarkerType.Circle; this.Expression = line.Expression; plotInterface = Plot; PlotYAxis = new Axis(); source.Plot.Add(Plot, XAxisPosition.Bottom, YAxisPosition.Left, 0, null, PlotYAxis); }
/// <summary> /// Adds a new set of points to the plot /// </summary> /// <param name="expression">The name of the paramter to determine the Y axis points</param> public PlotLine AddPlot(string symbol, string expression) { PlotLine newPlot = null; // Avoid duplicates if (Lines.Where((l) => { return(l.Expression.Equals(expression)); }).Count() == 0) { newPlot = new PlotLine(this, symbol, expression); Lines.Add(newPlot); } return(newPlot); }
protected override void OnCalculate() { Bollinger bb = Bollinger(2, 20); AddChartLine("Plot_Middle" + Time[0].ToString(), this.IsAutoAdjustableScale, 1, bb.Middle[1], 0, bb.Middle[0], this.Plot1Color, this.Dash1Style, this.Plot1Width); AddChartLine("Plot_Low" + Time[0].ToString(), this.IsAutoAdjustableScale, 1, bb.Lower[1], 0, bb.Lower[0], this.Plot0Color, this.Dash0Style, this.Plot0Width); AddChartLine("Plot_High" + Time[0].ToString(), this.IsAutoAdjustableScale, 1, bb.Upper[1], 0, bb.Upper[0], this.Plot0Color, this.Dash0Style, this.Plot0Width); if (High[0] < bb.Lower[0] || Low[0] > bb.Upper[0]) { //ok } else { this.BarColor = Color.White; } //Trigger double signal = 0; if (High[1] < bb.Lower[1]) { if (Low[0] > High[1] || High[0] > High[1]) { if (ShowArrows) { AddChartArrowUp("ArrowLong_Entry" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].Low, Color.LightGreen); } signal = 1; } } else if (Low[1] > bb.Upper[1]) { if (Low[0] < Low[1] || High[0] < Low[1]) { if (ShowArrows) { AddChartArrowDown("ArrowShort_Entry" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].High, Color.Red); } signal = -1; } } PlotLine.Set(signal); PlotColors[0][0] = this.Plot0Color; OutputDescriptors[0].PenStyle = this.Dash0Style; OutputDescriptors[0].Pen.Width = this.Plot0Width; }
internal virtual void drawGraph(javax.microedition.lcdui.Graphics g) { int old = g.Color; g.Color = LIGHTGRAY; g.fillRect(0, 0, width, height); for (int i = 0; i < PlotLines.Count; i++) { PlotLine line = (PlotLine)PlotLines[i]; line.paint(g); } g.Color = old; drawAxis(g); }
void TestSimplePlot1(AppHost host) { //------------ //create sample data //1. basic data=> a list of (x,y) point List <PointF> pointList = new List <PointF>(10); pointList.Add(new PointF(10 * 3, 20 * 3)); pointList.Add(new PointF(10 * 3, 80 * 3)); pointList.Add(new PointF(15 * 3, 30 * 3)); pointList.Add(new PointF(18 * 3, 40 * 3)); pointList.Add(new PointF(20 * 3, 20 * 3)); pointList.Add(new PointF(25 * 3, 25 * 3)); pointList.Add(new PointF(30 * 3, 10 * 3)); //2. from data create a presentation of that data int j = pointList.Count; List <PlotBox> plotBoxes = new List <PlotBox>(j); for (int i = 0; i < j; ++i) { PlotBox pt = new PlotBox(5, 5); PointF data = pointList[i]; pt.SetLocation((int)data.X, _chartHeight - (int)data.Y); //invertY pt.BackColor = Color.Red; plotBoxes.Add(pt); host.AddChild(pt); } //3. create connected line between each plotbox //... for (int i = 0; i < j - 1; ++i) { PlotBox p0 = plotBoxes[i]; PlotBox p1 = plotBoxes[i + 1]; PlotLine line = new PlotLine(p0, p1); host.AddChild(line); } }
/// <summary> /// Clears all lines from the plot /// </summary> public virtual void Clear() { // Restore the default data set this.DataSets = Session.Data; // Remove a plot line if it's expression is erased for (PlotLine plot = (this.Lines.Count > 0) ? this.Lines[0] : null; this.Lines.Count > 0; plot = (this.Lines.Count > 0) ? this.Lines[0] : null) { if (plot.Plot != null) { plot.Plot.Remove(this); } this.Lines.RemoveAt(0); } // Reset the colors so they are the same each time InitPlotColors(); }
/// <summary> /// Build a master report holding and comparing all reports /// </summary> /// <param name="reports">List with all reports to include</param> /// <returns>Master report</returns> public static Report BuildMaster(List <Report> reports) { if (reports.Count == 0) { return(null); } Report masterReport = new Report("All") { XAxisLabel = reports[0].XAxisLabel, YAxisLabel = reports[0].YAxisLabel }; foreach (var report in reports) { if (report.PlotLines.Count == 0) { continue; } masterReport.PlotTitles.Add(report.Name); for (int x = 0; x < report.PlotLines.Count; x++) { PlotLine line = masterReport.GetPlotLine(report.PlotLines[x].XAxis); if (line == null) { line = new PlotLine { XAxis = report.PlotLines[x].XAxis }; masterReport.PlotLines.Add(line); } if (report.PlotLines[x].Columns.Count == 0) { continue; } line.Columns.Add(report.PlotLines[x].Columns[0]); } } return(masterReport); }
public void LoadLine(PlotLine line) { this.acl.AddPlotLine(line); }
/// <summary> /// Creates an appropriate type of /// </summary> /// <returns>The created plot line</returns> protected static PlotContainer DefaultCreator(DataChart source, PlotLine line) { return(source.XAxis.Equals("Time") ? (PlotContainer) new LinePlotContainer(source, line) : new PointPlotContainer(source, line)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: void addLine(Object[] params) throws JasymcaException internal virtual void addLine(object[] @params) { if (!Hold_b) { reset(); } for (int i = 0; i < @params.Length;) { PlotLine line = new PlotLine(this); if (i < @params.Length - 1 && !(@params[i + 1] is string)) { double[] x = (double[])@params[i]; if (plotmode == LOGLIN || plotmode == LOGLOG) { log10(x); } line.lineMaxx = Math.Max(max(x), maxx); line.lineMinx = Math.Min(min(x), minx); double[] y = (double[])@params[i + 1]; if (plotmode == LINLOG || plotmode == LOGLOG) { log10(y); } line.lineMaxy = Math.Max(max(y), maxy); line.lineMiny = Math.Min(min(y), miny); if (x.Length != y.Length) { throw new JasymcaException("X and Y must be same length"); } line.setPoints(x, y); i += 2; } else { double[] x = (double[])@params[i]; if (plotmode == LINLOG || plotmode == LOGLOG) { log10(x); } maxx = x.Length; minx = 1; maxy = max(x); miny = min(x); line.x = new double[x.Length]; for (int ind = 0; ind < x.Length; ind++) { line.x[ind] = ind + 1; } line.setPoints(line.x, x); i++; } maxx = Math.Max(line.lineMaxx, maxx); minx = Math.Min(line.lineMinx, minx); maxy = Math.Max(line.lineMaxy, maxy); miny = Math.Min(line.lineMiny, miny); if (i < @params.Length && (@params[i] is string)) { line.LineAttributes = @params[i].ToString(); i++; } PlotLines.Add(line); } setMinMax(); repaint(); }
public void SetXAxis(PlotLine plotX) { this.acl.XAxis = plotX; }
public void LoadLine(string Caption, Decimal[] Points) { PlotLine line = new PlotLine(Caption); line.Points = Points.Cast<object>().ToArray(); this.acl.AddPlotLine(line); }
// // - - - Supplementary File Ops // /// <summary> /// Creates a ginormous dataDump string in a suitable cut and paste, Keep friendly, format, from all Stories in dictOfStories /// </summary> /// <returns></returns> public string CreateExportDataDump() { StringBuilder builderMain = new StringBuilder(); Dictionary <string, Story> dictOfStories = ToolManager.i.toolDataScript.GetDictOfStories(); if (dictOfStories != null) { int count; string characters; foreach (var story in dictOfStories) { //create an individual story builder StringBuilder builderStory = new StringBuilder(); //Story Details builderStory.AppendFormat("- - - NewAdventure{0}", "\n"); builderStory.AppendFormat("Name: {0}{1}", story.Value.tag, "\n"); builderStory.AppendFormat("Date: {0}{1}", story.Value.date, "\n"); builderStory.AppendFormat("NameSet: {0}{1}", story.Value.nameSet, "\n"); builderStory.AppendFormat("Theme: {0} / {1} / {2} / {3} / {4}{5}{6}", story.Value.theme.GetThemeType(1), story.Value.theme.GetThemeType(2), story.Value.theme.GetThemeType(3), story.Value.theme.GetThemeType(4), story.Value.theme.GetThemeType(5), "\n", "\n"); builderStory.AppendFormat("{0}{1}", story.Value.notes, "\n"); //Turning Point summary for (int i = 0; i < story.Value.arrayOfTurningPoints.Length; i++) { TurningPoint turningPoint = story.Value.arrayOfTurningPoints[i]; builderStory.AppendFormat("{0}TurningPoint {1}: {2}{3}{4}", "\n", i, turningPoint.tag, "\n", "\n"); builderStory.AppendFormat("Notes: {0}{1}", turningPoint.notes, "\n"); //summary builderStory.AppendFormat("{0}TurningPoint {1} Summary{2}", "\n", i, "\n"); for (int j = 0; j < turningPoint.arrayOfDetails.Length; j++) { PlotDetails details = turningPoint.arrayOfDetails[j]; characters = ""; //only character1 present if (details.character1.tag != null && details.character2.tag == null) { characters = string.Format("{0}", details.character1.tag.Length > 0 ? " -> " + details.character1.tag : ""); } //both present else if (details.character1.tag != null && details.character2.tag != null) { characters = string.Format("{0}{1}", details.character1.tag.Length > 0 ? " -> " + details.character1.tag : "", details.character2.tag.Length > 0 ? " / " + details.character2.tag : ""); } //neither present -> do nothing else if (details.character1.tag == null && details.character2.tag == null) { } //character1 null and character2 present -> Error condition as shouldn't happen else { Debug.LogWarningFormat("Invalid characters -> character1.tag {0}, character2.tag {1}, for plotPoint {2}", details.character1.tag == null ? "Null" : "O.K", details.character2.tag == null ? "Null" : "O.K", details.plotPoint); } builderStory.AppendFormat("[{0} {1}] {2}{3}", j, details.plotPoint, characters, "\n"); if (details.notes != null && details.notes.Length > 0) { builderStory.AppendFormat("{0}~{1}~{2}{3}", "\n", details.notes, "\n", "\n"); } } } //lists -> Active Plotline builderStory.AppendFormat("{0}- Active PlotLines{1}", "\n", "\n"); count = story.Value.lists.listOfPlotLines.Count; if (count > 0) { for (int i = 0; i < count; i++) { builderStory.AppendFormat("{0}{1}", story.Value.lists.listOfPlotLines[i].tag, "\n"); } } else { builderStory.AppendFormat("No active PlotLines remaining{0}{1}", "\n", "\n"); } //lists -> Removed Plotline builderStory.AppendFormat("{0}- Removed PlotLines{1}", "\n", "\n"); count = story.Value.lists.listOfRemovedPlotLines.Count; if (count > 0) { for (int i = 0; i < count; i++) { builderStory.AppendFormat("{0}{1}", story.Value.lists.listOfRemovedPlotLines[i].tag, "\n"); } } else { builderStory.AppendFormat("No plotLines have been Removed{0}{1}", "\n", "\n"); } //lists -> Characters builderStory.AppendFormat("{0}- Active Characters{1}", "\n", "\n"); count = story.Value.lists.listOfCharacters.Count; if (count > 0) { for (int i = 0; i < count; i++) { builderStory.AppendFormat("{0} -> {1}{2}", story.Value.lists.listOfCharacters[i].tag, story.Value.lists.listOfCharacters[i].dataCreated, "\n"); } } else { builderStory.AppendFormat("No active Characters remaining{0}{1}", "\n", "\n"); } //lists -> RemovedCharacters builderStory.AppendFormat("{0}- Removed Characters{1}", "\n", "\n"); count = story.Value.lists.listOfRemovedCharacters.Count; if (count > 0) { for (int i = 0; i < count; i++) { builderStory.AppendFormat("{0} -> {1}{2}", story.Value.lists.listOfRemovedCharacters[i].tag, story.Value.lists.listOfCharacters[i].dataCreated, "\n"); } } else { builderStory.AppendFormat("No characters have been removed{0}{1}", "\n", "\n"); } //Characters in detail -> Active Characters builderStory.AppendFormat("{0}- Active Characters in Detail{1}", "\n", "\n"); count = story.Value.lists.listOfCharacters.Count; if (count > 0) { for (int i = 0; i < count; i++) { Character character = story.Value.lists.listOfCharacters[i]; builderStory.AppendFormat("{0}{1}", character.tag, "\n"); builderStory.AppendFormat(" {0}{1}", character.dataCreated, "\n"); //notes for (int j = 0; j < character.listOfNotes.Count; j++) { builderStory.AppendFormat("Note: {0}{1}", character.listOfNotes[j], "\n"); } } } else { builderStory.AppendFormat("No active Characters remaining{0}{1}", "\n", "\n"); } //Characters in detail -> Removed Characters builderStory.AppendFormat("{0}- Removed Characters in Detail{1}", "\n", "\n"); count = story.Value.lists.listOfRemovedCharacters.Count; if (count > 0) { for (int i = 0; i < count; i++) { Character character = story.Value.lists.listOfRemovedCharacters[i]; builderStory.AppendFormat("{0}{1}", character.tag, "\n"); builderStory.AppendFormat(" {0}{1}", character.dataCreated, "\n"); //notes for (int j = 0; j < character.listOfNotes.Count; j++) { builderStory.AppendFormat("Note: {0}{1}", character.listOfNotes[j], "\n"); } } } else { builderStory.AppendFormat("No characters have been removed{0}{1}", "\n", "\n"); } //PlotLines in detail -> Active builderStory.AppendFormat("{0}- Active PlotLines in Detail{1}", "\n", "\n"); count = story.Value.lists.listOfPlotLines.Count; if (count > 0) { for (int i = 0; i < count; i++) { PlotLine plotLine = story.Value.lists.listOfPlotLines[i]; builderStory.AppendFormat("{0}{1}", plotLine.tag, "\n"); //notes for (int j = 0; j < plotLine.listOfNotes.Count; j++) { builderStory.AppendFormat("Note: {0}{1}", plotLine.listOfNotes[j], "\n"); } builderStory.AppendLine(); } } else { builderStory.AppendFormat("No active plotLines remaining{0}{1}", "\n", "\n"); } //PlotLines in detail -> Removed builderStory.AppendFormat("- Removed PlotLines in Detail{0}", "\n"); count = story.Value.lists.listOfRemovedPlotLines.Count; if (count > 0) { for (int i = 0; i < count; i++) { PlotLine plotLine = story.Value.lists.listOfRemovedPlotLines[i]; builderStory.AppendFormat("{0}{1}", plotLine.tag, "\n"); //notes for (int j = 0; j < plotLine.listOfNotes.Count; j++) { builderStory.AppendFormat("Note: {0}{1}", plotLine.listOfNotes[j], "\n"); } builderStory.AppendLine(); } } else { builderStory.AppendFormat("No plotLines have been removed{0}{1}", "\n", "\n"); } //add story to main builder builderMain.Append(builderStory); builderMain.AppendLine(); builderMain.AppendLine(); } } else { Debug.LogError("Invalid dictOfStories (Null)"); } return(builderMain.ToString()); }