/// <summary> /// Sets the binding for strokeand stroke thickness. /// </summary> /// <param name="part">The part.</param> protected override void SetBindingForStrokeandStrokeThickness(SeriesPartBase part) { HiLoOpenClosePart hiLoOpenClosePart = part as HiLoOpenClosePart; Binding strokeBinding = new Binding { Source = this }; if (hiLoOpenClosePart.IsBearfill) { strokeBinding.Path = new PropertyPath("BearFill"); } else { strokeBinding.Path = new PropertyPath("BullFill"); } Binding strokeThicknessBinding = new Binding { Path = new PropertyPath("StrokeThickness"), Source = this }; part.SetBinding(SeriesPartBase.StrokeProperty, strokeBinding); part.SetBinding(SeriesPartBase.StrokeThicknessProperty, strokeThicknessBinding); }
/// <summary> /// Generates the datas. /// </summary> public override void GenerateDatas() { LowPoints.Clear(); HighPoints.Clear(); OpenPoints.Clear(); ClosePoints.Clear(); if (!IsPointsGenerated) { Parts.Clear(); } if (this.Points != null && this.SeriesContainer != null) { CalculateMinAndMax(); OpenOffPoints = new PointCollection(); CloseOffPoints = new PointCollection(); ChartPoint oldPoint = new ChartPoint() { XValue = double.MinValue, YValue = double.MinValue }; IntializePoints(); int index = 0; Point startAndEndPoint = CalculateSeriesInfo(); foreach (ChartPoint point in this.Points) { if (CheckValuePoint(oldPoint, point)) { Point highPoint = NormalizePoint(new Point(point.XValue, point.YValue)); Point lowPoint = NormalizePoint(new Point(lowPoints[index].XValue, lowPoints[index].YValue)); Point openPoint = NormalizePoint(new Point(openPoints[index].XValue, openPoints[index].YValue)); Point closePoint = NormalizePoint(new Point(closePoints[index].XValue, closePoints[index].YValue)); Point openOffPoint = NormalizePoint(new Point(openPoints[index].XValue + startAndEndPoint.X, openPoints[index].YValue)); Point closeOffPoint = NormalizePoint(new Point(closePoints[index].XValue - startAndEndPoint.X, closePoints[index].YValue)); HighPoints.Add(highPoint); LowPoints.Add(lowPoint); OpenPoints.Add(openPoint); ClosePoints.Add(closePoint); OpenOffPoints.Add(openOffPoint); CloseOffPoints.Add(closeOffPoint); oldPoint = point; } index++; } if (this.RenderingMode == RenderingMode.Default) { if (!IsPointsGenerated) { for (int i = 0; i < this.HighPoints.Count; i++) { HiLoOpenClosePart hiLoOpenClosePart = new HiLoOpenClosePart(this.HighPoints[i], this.LowPoints[i], this.ClosePoints[i], this.CloseOffPoints[i], this.OpenPoints[i], this.OpenOffPoints[i]); if (this.openPoints[i].YValue <= this.closePoints[i].YValue) { hiLoOpenClosePart.IsBearfill = true; } else { hiLoOpenClosePart.IsBearfill = false; } SetBindingForStrokeandStrokeThickness(hiLoOpenClosePart); this.Parts.Add(hiLoOpenClosePart); } IsPointsGenerated = true; } else { int i = 0; foreach (HiLoOpenClosePart part in this.Parts) { part.Point1 = this.HighPoints[i]; part.Point2 = this.LowPoints[i]; part.Point3 = this.ClosePoints[i]; part.Point4 = this.CloseOffPoints[i]; part.Point5 = this.OpenPoints[i]; part.Point6 = this.OpenOffPoints[i]; part.Refresh(); i++; } } } } else { Parts.Clear(); } if (this.SeriesContainer != null) { this.SeriesContainer.Invalidate(); } IsRefreshed = false; }