I'm attaching basic code; I've tried a number of modifications of cellWidth and cellHeight but haven't found anything that works and allows dynamic scaling. (The problem is much more visible when opacity is set below 100%.)
Is there a way to do this someone could show me?
protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { if(Bars == null || Bars.Instrument == null || IsInHitTest) return; int firstBarPainted = ChartBars.FromIndex; int lastBarPainted = ChartBars.ToIndex; double tickSize = Bars.Instrument.MasterInstrument.TickSize; double highPrice = chartScale.MaxValue; double lowPrice = chartScale.MinValue; float cellWidth = chartControl.GetXByBarIndex(ChartBars, lastBarPainted) - chartControl.GetXByBarIndex(ChartBars, lastBarPainted-1) ; float cellHeight = chartScale.GetYByValue(highPrice) - chartScale.GetYByValue(highPrice - TickSize); for (int i = firstBarPainted; i <= lastBarPainted; i ++ ) { float xpos = chartControl.GetXByBarIndex(ChartBars, i); for (double p = highPrice; p >= lowPrice; p -= tickSize) { RenderTarget.FillRectangle(new RectangleF(xpos , chartScale.GetYByValue(p), cellWidth, cellHeight), Brushes.Gray.ToDxBrush(RenderTarget)); } } }
Comment