/// <summary> /// Returns the style to use for all data points. /// </summary> /// <returns>The style to use for all data points.</returns> //protected override Style GetDataPointStyleFromHost() //{ // return SeriesHost.NextStyle(typeof(CandlestickDataPoint), true); //} /// <summary> /// This method updates a single data point. /// </summary> /// <param name="dataPoint">The data point to update.</param> protected override void UpdateDataPoint(DataPoint dataPoint) { CandlestickDataPoint candlestickDataPoint = (CandlestickDataPoint)dataPoint; double PlotAreaHeight = ActualDependentRangeAxis.GetPlotAreaCoordinate(ActualDependentRangeAxis.Range.Maximum).Value; double dataPointX = ActualIndependentRangeAxis.GetPlotAreaCoordinate(dataPoint.ActualIndependentValue).Value; double highPointY = ActualDependentRangeAxis.GetPlotAreaCoordinate(ValueHelper.ToDouble(candlestickDataPoint.High)).Value; double lowPointY = ActualDependentRangeAxis.GetPlotAreaCoordinate(ValueHelper.ToDouble(candlestickDataPoint.Low)).Value; double openPointY = ActualDependentRangeAxis.GetPlotAreaCoordinate(ValueHelper.ToDouble(candlestickDataPoint.Open)).Value; double closePointY = ActualDependentRangeAxis.GetPlotAreaCoordinate(ValueHelper.ToDouble(candlestickDataPoint.Close)).Value; candlestickDataPoint.UpdateBody(ActualDependentRangeAxis); if (ValueHelper.CanGraph(dataPointX)) { dataPoint.Height = Math.Abs(highPointY - lowPointY); dataPoint.Width = 5.0; if (dataPoint.ActualWidth == 0.0 || dataPoint.ActualHeight == 0.0) { dataPoint.UpdateLayout(); } Canvas.SetLeft(dataPoint, Math.Round(dataPointX - (dataPoint.ActualWidth / 2))); Canvas.SetTop(dataPoint, Math.Round(PlotAreaHeight - highPointY)); } }
protected override void PrepareDataPoint(DataPoint dataPoint, object dataContext) { base.PrepareDataPoint(dataPoint, dataContext); CandlestickDataPoint candlestickDataPoint = (CandlestickDataPoint)dataPoint; candlestickDataPoint.SetBinding(CandlestickDataPoint.OpenProperty, OpenValueBinding); candlestickDataPoint.SetBinding(CandlestickDataPoint.CloseProperty, CloseValueBinding); candlestickDataPoint.SetBinding(CandlestickDataPoint.HighProperty, HighValueBinding); candlestickDataPoint.SetBinding(CandlestickDataPoint.LowProperty, LowValueBinding); }