private void UpdateLabelPostion() { if (this.radChartView1.Series.Count > 0) { foreach (TwoLabelOhlcPointElement point in radChartView1.Series[0].Children) { OhlcLabelElement lowerLabel = point.Children[1] as OhlcLabelElement; if (lowerLabel != null) { lowerLabel.PositionOffset = new PointF(0, (float)(point.DataPoint.LayoutSlot.Height + lowerLabel.GetLayoutSlot().Height + 5)); } } } }
private void SetupOhlcLabels() { if (this.radChartView1.Series.Count > 0) { foreach (TwoLabelOhlcPointElement point in this.radChartView1.Series[0].Children) { OhlcLabelElement upperLabel = point.Children[0] as OhlcLabelElement; if (upperLabel != null) { upperLabel.Text = (point.DataPoint as OhlcDataPoint).Open.ToString(); } OhlcLabelElement lowerLabel = point.Children[1] as OhlcLabelElement; if (lowerLabel != null) { lowerLabel.Text = (point.DataPoint as OhlcDataPoint).Close.ToString(); } } } }
void radChartView1_LabelFormatting(object sender, ChartViewLabelFormattingEventArgs e) { OhlcLabelElement label = e.LabelElement as OhlcLabelElement; if (enableFormatting) { label.Font = formattingFont; bool isFalling = ((OhlcDataPoint)e.LabelElement.DataPoint).IsFalling; if (label.PositionOffset != PointF.Empty) { if (isFalling) { label.ForeColor = Color.FromArgb(210, 0, 0); } else { label.ForeColor = Color.FromArgb(102, 102, 102); } } else { if (isFalling) { label.ForeColor = Color.Black; } else { label.ForeColor = Color.FromArgb(0, 150, 0); } } } else { label.ResetValue(UIChartElement.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local); label.ResetValue(UIChartElement.FontProperty, Telerik.WinControls.ValueResetFlags.Local); } }