public void Initialize(BarsUnscaled barsAllAvailable) { this.BarsForChartThumbnail = barsAllAvailable; this.ResetLowestHighest(); if (this.HasDataToDraw) { for (int i = 0; i < this.BarsForChartThumbnail.Count; i++) { Bar bar = this.BarsForChartThumbnail[i]; double close = bar.Close; if (close < this.closeLowest) { this.closeLowest = close; } if (close > this.closeHighest) { this.closeHighest = close; } } } //too early because we don't know Control.Height (or it's shadow base.RangeBar.BufferedGraphics.Graphics.VisibleClipBounds.Height) //this.BuildGraphTimeConsuming(); // DONT_FORCE_NOW_ON_PAINT_WILL_BUILD_THANX_HasDataToDraw this.BuildGraphInNewThreadAndInvalidateDelayed(); // UNCOMMENTED_TO_DRAW_WHATEVER_BARS_INITIALIZED_FIRST_TIME_DOESNT_WORK this.BuildGraphInNewThreadAndInvalidateDelayed(); base.RangeBarWithGraph.BufferReset(); // will trigger Invalidate() }
public void Initialize(BarsUnscaled barsAllAvailable, BarsUnscaled barsActivated = null) { if (barsActivated == null) { barsActivated = barsAllAvailable; } if (barsAllAvailable.BarFirst == null) { string msg = "barsAllAvailable.FirstStaticBar=null; barsAllAvailable[" + barsAllAvailable + "]"; throw new Exception(msg); } if (barsActivated.BarFirst == null) { string msg = "barsActivated.FirstStaticBar=null; barsActivated[" + barsActivated + "]"; throw new Exception(msg); } //DateTime lastBarAvailable = (barsAllAvailable.StreamingBarSafeClone.DateTimeOpen); //DateTime lastBarActivated = (barsActivated.StreamingBarSafeClone.DateTimeOpen); DateTime lastBarAvailable = (barsAllAvailable.BarLast.DateTimeOpen); DateTime lastBarActivated = (barsActivated.BarLast.DateTimeOpen); if (lastBarAvailable < lastBarActivated) { string msg = "lastBarAvailable[" + lastBarAvailable + "] < lastBarActivated[" + lastBarActivated + "];" + " available[" + barsAllAvailable + "], activated[" + barsActivated + "]"; throw new Exception(msg); } base.RangeMin = barsAllAvailable.BarFirst.DateTimeOpen; base.RangeMax = lastBarAvailable; base.ValueMin = barsActivated.BarFirst.DateTimeOpen; base.ValueMax = lastBarActivated; base.GraphBuilder.Initialize(barsAllAvailable); //DOESNT_HELP_TO_DRAW_FIRST_TIME_AFTER_INITIALIZED this.Invalidate(); }