Steps to reproduce: 1. Add a chart to a form. 2. Add any cartesian series 3. Set the LabelFitMode of the horizontal axis to Rotate. You will see that labels have incorrect layout.
To reproduce: - Add at least two series and zoom the chart so the point from one of the series are visible only - Move the TrackBall - The Track ball is not shown for some of the points.
Currently RadChartView does not support null values.
To reproduce: public Form1() { InitializeComponent(); ScatterSeries series = new ScatterSeries(); series.DataPoints.Add(new ScatterDataPoint(5, 5)); series.DataPoints.Add(new ScatterDataPoint(4, 2)); series.DataPoints.Add(new ScatterDataPoint(-1, 3)); series.DataPoints.Add(new ScatterDataPoint(8, 4)); radChartView1.Series.Add(series); LinearAxis horizontalAxis = radChartView1.Axes.Get<LinearAxis>(0); horizontalAxis.Minimum = -10; horizontalAxis.Maximum = 10; } private void radButton1_Click(object sender, EventArgs e) { LinearAxis horizontalAxis = radChartView1.Axes.Get<LinearAxis>(0); horizontalAxis.DesiredTickCount = 20; }
Steps to reproduce. 1. Add a chart view to a form. 2. Create a series and add several data points. For categories use double values in the range 10 - 20 3. Create a second series and this time for categories use double values in the same range without duplication. 4. Assign one linear and one categorical axis to the series and add them to the char view. 5. Run the project and you will see that the categories from the second series are next to those from the first series, while they should be combined according their values.
I'm using version 2012.3.1310.40 I use ChartView to create a pie chart with the following data Assets 2248550.22 Income 19748.67 Equity 2228253.95 Liability 547.60 So, when the chart displays, the Percentage is set as follows: Assets 50% Income 0% Equity 50% Liability 0% I notice when the percentage is 0% for any data, the pie chart shows "0%" near the chart title (please see attachment). Or if the calculated data returns 0, it doesn't show any percentage on the chart, but it will shows "NaN" near the title as well. (please see attachment).
Note: similar to the axis, the series should also have ClipLabels property which will control whether the labels will be clipped or not. How to reproduce: zoom and pan along the chart public Form1() { InitializeComponent(); this.radChartView1.CreateRenderer += radChartView1_CreateRenderer; this.radChartView1.ShowPanZoom = true; BarSeries barSeries = new BarSeries(); Random rand = new Random(); for (int i = 1; i < 10; i++) { barSeries.DataPoints.Add(new CategoricalDataPoint(rand.Next(100), i)); } barSeries.ShowLabels = true; this.radChartView1.Series.Add(barSeries); } Workaround: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radChartView1.CreateRenderer += radChartView1_CreateRenderer; this.radChartView1.ShowPanZoom = true; BarSeries barSeries = new BarSeries(); Random rand = new Random(); for (int i = 1; i < 10; i++) { barSeries.DataPoints.Add(new CategoricalDataPoint(rand.Next(100), i)); } barSeries.ShowLabels = true; this.radChartView1.Series.Add(barSeries); } private void radChartView1_CreateRenderer(object sender, ChartViewCreateRendererEventArgs e) { e.Renderer = new CustomCartesianRenderer(e.Area as CartesianArea); } } public class CustomCartesianRenderer : CartesianRenderer { public CustomCartesianRenderer(CartesianArea area) : base(area) { } protected override void Initialize() { base.Initialize(); for (int i = 0; i < this.DrawParts.Count; i++) { BarLabelElementDrawPart labelPart = this.DrawParts[i] as BarLabelElementDrawPart; if (labelPart != null) { this.DrawParts[i] = new CustomLabelElementDrawPart((BarSeries)labelPart.Element, this); } } } } public class CustomLabelElementDrawPart : BarLabelElementDrawPart { public CustomLabelElementDrawPart(ChartSeries owner, IChartRenderer renderer) : base(owner, renderer) { } public override void Draw() { Graphics graphics = this.Renderer.Surface as Graphics; CartesianSeries cartesianSeries = this.Element as CartesianSeries; if (cartesianSeries != null) { CartesianArea area = (CartesianArea)cartesianSeries.GetType().GetField("area", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(cartesianSeries); RectangleF clipRect = (RectangleF)area.GetType().GetMethod("GetCartesianClipRect", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(area, new object[] { });//.GetCartesianClipRect(); graphics.SetClip(clipRect); } base.Draw(); graphics.ResetClip(); } }
Workaround: public class CustomLassoZoomController : LassoZoomController { protected override ActionResult OnMouseUp(MouseEventArgs e) { if (this.MouseDownLocation == Point.Empty || this.MouseMoveLocation == Point.Empty) { return Controller.Empty; } return base.OnMouseUp(e); } } public Form1() { InitializeComponent(); BarSeries barSeries = new BarSeries("Performance", "RepresentativeName"); barSeries.Name = "Q1"; barSeries.DataPoints.Add(new CategoricalDataPoint(177, "Harley")); barSeries.DataPoints.Add(new CategoricalDataPoint(128, "White")); barSeries.DataPoints.Add(new CategoricalDataPoint(143, "Smith")); barSeries.DataPoints.Add(new CategoricalDataPoint(111, "Jones")); barSeries.DataPoints.Add(new CategoricalDataPoint(118, "Marshall")); this.radChartView1.Series.Add(barSeries); BarSeries barSeries2 = new BarSeries("Performance", "RepresentativeName"); barSeries2.Name = "Q2"; barSeries2.DataPoints.Add(new CategoricalDataPoint(153, "Harley")); barSeries2.DataPoints.Add(new CategoricalDataPoint(141, "White")); barSeries2.DataPoints.Add(new CategoricalDataPoint(130, "Smith")); barSeries2.DataPoints.Add(new CategoricalDataPoint(88, "Jones")); barSeries2.DataPoints.Add(new CategoricalDataPoint(109, "Marshall")); this.radChartView1.Series.Add(barSeries2); CustomLassoZoomController lassoZoomController = new CustomLassoZoomController(); radChartView1.Controllers.Add(lassoZoomController); }
Hello Telerik Support,
after taking my first steps with RangeSelector and ChartView controls I found an issue with a simple bar chart. The length of some bars in the chart of the RangeSelector doesn't match with the bars in the ChartView. The relation is wrong.I provided a screenshot and marked the bars. I could provide a sample application, but I can't attach a zip file, so here's the code of the main form:
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
Telerik.WinControls;
using
Telerik.WinControls.UI;
namespace
TelerikChartView
{
public
partial
class
MainForm : Telerik.WinControls.UI.RadForm
{
private
List<Kapazitaetspunkt> _BackListPunkte;
private
BindingList<Kapazitaetspunkt> Punkte;
public
MainForm()
{
InitializeComponent();
}
private
void
MainForm_Load(
object
sender, EventArgs e)
{
_BackListPunkte =
new
List<Kapazitaetspunkt>();
Punkte =
new
BindingList<Kapazitaetspunkt>(_BackListPunkte);
//Punkte = new BindingList<Kapazitaetspunkt>();
rngTimeSelector.AssociatedControl = cvChart;
rngTimeSelector.RangeSelectorElement.ScrollSelectorElement.Visibility = ElementVisibility.Collapsed;
BarSeries bars =
new
BarSeries();
bars.DataSource = Punkte;
bars.ValueMember = nameof(Kapazitaetspunkt.Percentage);
bars.CategoryMember = nameof(Kapazitaetspunkt.Date);
cvChart.Series.Add(bars);
}
private
void
GenerateTestData(
int
addMonths = 0)
{
Punkte.Clear();
const
int
count = 25;
const
int
step = 4;
var von = DateTime.Today.AddMonths(addMonths);
var bis = von.AddDays(count);
double
percentage = 0;
//_BackListPunkte.Add(new Kapazitaetspunkt(von.AddDays(-1), null));
Punkte.Add(
new
Kapazitaetspunkt(von.AddDays(-1),
null
));
while
(von < bis)
{
//_BackListPunkte.Add(new Kapazitaetspunkt(von, percentage));
Punkte.Add(
new
Kapazitaetspunkt(von, percentage));
percentage += step;
von = von.AddDays(1);
}
//_BackListPunkte.Add(new Kapazitaetspunkt(von.AddDays(1), null));
Punkte.Add(
new
Kapazitaetspunkt(von.AddDays(1),
null
));
}
private
void
btnGenerateData_Click(
object
sender, EventArgs e)
{
GenerateTestData();
rngTimeSelector.RangeSelectorElement.InitializeElements();
rngTimeSelector.RangeSelectorElement.ResetLayout(
true
);
}
private
void
btnGenerateData2_Click(
object
sender, EventArgs e)
{
GenerateTestData(2);
rngTimeSelector.RangeSelectorElement.InitializeElements();
rngTimeSelector.RangeSelectorElement.ResetLayout(
true
);
}
private
void
rngTimeSelector_ScaleInitializing(
object
sender, ScaleInitializingEventArgs e)
{
e.Cancel =
true
;
}
}
public
class
Kapazitaetspunkt : INotifyPropertyChanged
{
private
DateTime _Date;
public
DateTime Date
{
get
=> _Date;
set
{
if
(value != Date)
{
_Date = value;
OnPropertyChanged();
}
}
}
public
double
? _Percentage;
public
double
? Percentage
{
get
=> _Percentage;
set
{
if
(value != Percentage)
{
_Percentage = value;
OnPropertyChanged();
}
}
}
public
Kapazitaetspunkt(DateTime date,
double
? percentage)
{
Date = date;
Percentage = percentage;
}
public
event
PropertyChangedEventHandler PropertyChanged;
protected
virtual
void
OnPropertyChanged([CallerMemberName]
string
propertyName =
null
)
{
PropertyChanged?.Invoke(
this
,
new
PropertyChangedEventArgs(propertyName));
}
}
}
Regards,
Stephan
To reproduce: please refer to the attached sample project and gif file. Workaround: CustomLassoSelectionController lassoSelectionController = new CustomLassoSelectionController(); this.radChartView1.Controllers.Add(lassoSelectionController); public class CustomLassoSelectionController : LassoSelectionController { private IList<DataPoint> selectedPoints = null; public CustomLassoSelectionController() { this.selectedPoints = new List<DataPoint>(); } private Point ClipLocation(Point point) { CartesianArea area = this.Area.View.GetArea<CartesianArea>(); if (area != null) { RectangleF clipRect = GetCartesianClipRect(area); if (point.X < clipRect.X) { point = new Point((int)clipRect.X, point.Y); } if (point.X > clipRect.Width + clipRect.X) { point = new Point((int)clipRect.Width + (int)clipRect.X, point.Y); } if (point.Y < clipRect.Y) { point = new Point(point.X, (int)clipRect.Y); } if (point.Y > clipRect.Height + clipRect.Y) { point = new Point(point.X, (int)clipRect.Height + (int)clipRect.Y); } } return point; } internal RectangleF GetCartesianClipRect(CartesianArea area) { float x1, x2, y1, y2; x1 = 0; y1 = 0; x2 = (float)area.View.Viewport.Right; y2 = (float)area.View.Viewport.Bottom; foreach (var axis in area.View.Axes) { if (axis.AxisType == AxisType.First) { if (axis.Model.VerticalLocation == AxisVerticalLocation.Bottom) { y2 = Math.Min(y2, (float)axis.Model.LayoutSlot.Y); } else { y1 = Math.Max(y1, (float)axis.Model.LayoutSlot.Bottom); } x1 = Math.Min(x1, (float)axis.Model.LayoutSlot.X); x2 = Math.Min(x2, (float)axis.Model.LayoutSlot.Right); } else { if (axis.Model.HorizontalLocation == AxisHorizontalLocation.Left) { x1 = Math.Max(x1, (float)axis.Model.LayoutSlot.Right); } else { x2 = Math.Min(x2, (float)axis.Model.LayoutSlot.X); } y1 = Math.Max(y1, (float)axis.Model.LayoutSlot.Y); y2 = Math.Min(y2, (float)axis.Model.LayoutSlot.Bottom); } } RectangleF result = new RectangleF((float)area.View.Viewport.X + x1, (float)area.View.Viewport.Y + y1, x2 - x1 + 1, y2 - y1 + 1); return result; } protected override ActionResult OnMouseUp(MouseEventArgs e) { if (e.Button != MouseButtons.Left || this.MouseDownLocation == Point.Empty || this.MouseMoveLocation == Point.Empty) { return base.OnMouseUp(e); } if (MouseDownLocation != MouseMoveLocation) { this.MouseMoveLocation = ClipLocation(e.Location); CartesianArea area = this.Area.View.GetArea<CartesianArea>(); if (area != null) { this.selectedPoints.Clear(); RectangleF areaRect = RectangleF.Empty; IChartView chartView = this.Area.View; areaRect = GetCartesianClipRect(area); Point topLeft = new Point(Math.Min(MouseDownLocation.X, e.X), Math.Min(MouseDownLocation.Y, e.Y)); Point lowerRight = new Point(Math.Max(MouseDownLocation.X, e.X), Math.Max(MouseDownLocation.Y, e.Y)); RectangleF lassoRect = new RectangleF(new PointF(topLeft.X - (float)chartView.PlotOriginX - area.View.Margin.Left, topLeft.Y - (float)chartView.PlotOriginY - area.View.Margin.Top), new SizeF(lowerRight.X - topLeft.X, lowerRight.Y - topLeft.Y)); foreach (var series in area.View.Series) { foreach (var dataPoint in series.DataPoints) { if (lassoRect.Contains(new PointF((float)dataPoint.LayoutSlot.Location.X, (float)dataPoint.LayoutSlot.Location.Y))) { dataPoint.IsSelected = true; this.selectedPoints.Add(dataPoint); } else { dataPoint.IsSelected = false; } } } ChartDataPointsEventArgs changedArgs = new ChartDataPointsEventArgs(this.selectedPoints); this.OnLassoSelectedPointsChanged(changedArgs); } MouseDownLocation = MouseMoveLocation = Point.Empty; } this.Result.ShouldInvalidate = true; return this.Result; } }
Steps to reproduce: 1. Create an instance of any chart series 2. Set the Palette property to a new/existing PaletteEntry instance with any colors Run the project and you will see an exception.
Steps to reproduce: 1. Add chart to a form. 2. Add two bar series with CombineMode set to Stack100 3. Add two data points to the series with values 0.0 and identical category 4. Run the project an you will see an exception.
How to reproduce: Dim table As New DataTable() table.Columns.Add("Name", GetType(String)) table.Columns.Add("X", GetType(Integer)) For i As Integer = 0 To 99 table.Rows.Add($"User {i}", i) Next Dim series As New BarSeries() series.DataSource = table series.CategoryMember = "Name" series.ValueMember = "X" RadChartView1.Series.Add(series) CType(RadChartView1.Area, CartesianArea).Orientation = Orientation.Horizontal Dim panZoomController As New ChartPanZoomController() panZoomController.PanZoomMode = ChartPanZoomMode.Vertical RadChartView1.Controllers.Add(panZoomController) RadChartView1.Zoom(1, 8) Workaround: create a custom ChartPanZoomController Dim panZoomController As New MyChartPanZoomController() panZoomController.PanZoomMode = ChartPanZoomMode.Vertical RadChartView1.Controllers.Add(panZoomController) Public Class MyChartPanZoomController Inherits ChartPanZoomController Protected Overrides Function OnMouseMove(e As MouseEventArgs) As ActionResult Dim cartesianArea As CartesianArea = TryCast(Me.Area, CartesianArea) If cartesianArea Is Nothing Then Return MyBase.OnMouseMove(e) End If Dim panPoint As Point? = Me.GetType().BaseType.GetField("panPoint", BindingFlags.Instance Or BindingFlags.NonPublic).GetValue(Me) If e.Button = MouseButtons.Left AndAlso panPoint.HasValue Then Dim offsetX As Double = Me.GetType().BaseType.GetField("offsetX", BindingFlags.Instance Or BindingFlags.NonPublic).GetValue(Me) Dim currentOffsetX As Double = offsetX Dim defaultAxis As Axis = If(cartesianArea.Orientation = Orientation.Horizontal, Me.Area.GetType().GetMethod("GetDefaultFirstAxis", BindingFlags.Instance Or BindingFlags.NonPublic).Invoke(Me.Area, New Object() {}), Me.Area.GetType().GetMethod("GetDefaultSecondAxis", BindingFlags.Instance Or BindingFlags.NonPublic).Invoke(Me.Area, New Object() {})) If Me.PanZoomMode = ChartPanZoomMode.Horizontal OrElse Me.PanZoomMode = ChartPanZoomMode.Both Then currentOffsetX += (panPoint.Value.X - e.Location.X) * -1 If currentOffsetX > 0 Then currentOffsetX = 0 End If If currentOffsetX < defaultAxis.Model.LayoutSlot.Width * (DirectCast(cartesianArea.View, IChartView).ZoomWidth - 1) Then currentOffsetX = -defaultAxis.Model.LayoutSlot.Width * (DirectCast(cartesianArea.View, IChartView).ZoomWidth - 1) End If End If Dim offsetY As Double = Me.GetType().BaseType.GetField("offsetY", BindingFlags.Instance Or BindingFlags.NonPublic).GetValue(Me) Dim currentOffsetY As Double = offsetY If Me.PanZoomMode = ChartPanZoomMode.Vertical OrElse Me.PanZoomMode = ChartPanZoomMode.Both Then currentOffsetY += (panPoint.Value.Y - e.Location.Y) * -1 If currentOffsetY > 0 Then currentOffsetY = 0 End If If currentOffsetY < -defaultAxis.Model.LayoutSlot.Height * (DirectCast(cartesianArea.View, IChartView).ZoomHeight - 1) Then currentOffsetY = -defaultAxis.Model.LayoutSlot.Height * (DirectCast(cartesianArea.View, IChartView).ZoomHeight - 1) End If End If cartesianArea.View.Pan(currentOffsetX, currentOffsetY) End If Return Controller.Empty End Function End Class
When trying to drill down PieChart on RadChartView the code throws exception. Workaround: private void radChartView_Drill(object sender, DrillEventArgs e){ e.View.Parent = this.radChartViewUsers.ChartElement.Wrapper; e.View.AreaType = ChartAreaType.Pie; //do drill logic}
To reproduce: Add Series and Axes to a RadChartView and a ChartPanZoomController. Zoom and pan a little, then clear all the series and axes and add new ones. Try to pan now.
To reproduce: private void RadChartView1_LabelFormatting(object sender, ChartViewLabelFormattingEventArgs e) { var dataPoint = e.LabelElement.DataPoint as CategoricalDataPoint; if (dataPoint != null) { e.LabelElement.IsVisible = false; } } Workaround: private void RadChartView1_LabelFormatting(object sender, ChartViewLabelFormattingEventArgs e) { var dataPoint = e.LabelElement.DataPoint as CategoricalDataPoint; if (dataPoint != null) { e.LabelElement.Text = ""; } }
To reproduce: Have a RadButton and a RadChartView on a form. On button click use the following code: private void GenerateSeries() { LineSeries lineSeries = new LineSeries(); lineSeries.DataPoints.Add(new CategoricalDataPoint(20, "Jan") { Label = "January" }); lineSeries.DataPoints.Add(new CategoricalDataPoint(22, "Apr")); lineSeries.DataPoints.Add(new CategoricalDataPoint(12, "Jul")); lineSeries.DataPoints.Add(new CategoricalDataPoint(19, "Oct")); lineSeries.LegendTitle = "Line 1 "; this.Chart.Series.Add(lineSeries); lineSeries.BackColor = Color.Black; lineSeries.PointSize = new SizeF(15, 15); LineSeries lineSeries2 = new LineSeries(); lineSeries2.DataPoints.Add(new CategoricalDataPoint(18, "Jan")); lineSeries2.DataPoints.Add(new CategoricalDataPoint(15, "Apr")); lineSeries2.DataPoints.Add(new CategoricalDataPoint(17, "Jul")); lineSeries2.DataPoints.Add(new CategoricalDataPoint(22, "Oct")); lineSeries2.LegendTitle = "Line 2 "; this.Chart.Series.Add(lineSeries2); } void RadButton_Click(object sender, EventArgs e) { this.Chart.Series.Clear(); this.GenerateSeries(); } You will notice that the memory will not decrease after a few presses of the button. Workaround: Set the Provider of the LegendElement to null: private void GenerateSeries() { this.Chart.ChartElement.LegendElement.Provider = null; LineSeries lineSeries = new LineSeries(); lineSeries.DataPoints.Add(new CategoricalDataPoint(20, "Jan") { Label = "January" }); lineSeries.DataPoints.Add(new CategoricalDataPoint(22, "Apr")); lineSeries.DataPoints.Add(new CategoricalDataPoint(12, "Jul")); lineSeries.DataPoints.Add(new CategoricalDataPoint(19, "Oct")); lineSeries.LegendTitle = "Line 1 "; this.Chart.Series.Add(lineSeries); lineSeries.BackColor = Color.Black; lineSeries.PointSize = new SizeF(15, 15); LineSeries lineSeries2 = new LineSeries(); lineSeries2.DataPoints.Add(new CategoricalDataPoint(18, "Jan")); lineSeries2.DataPoints.Add(new CategoricalDataPoint(15, "Apr")); lineSeries2.DataPoints.Add(new CategoricalDataPoint(17, "Jul")); lineSeries2.DataPoints.Add(new CategoricalDataPoint(22, "Oct")); lineSeries2.LegendTitle = "Line 2 "; this.Chart.Series.Add(lineSeries2); } void Button_Click(object sender, EventArgs e) { this.Chart.Series.Clear(); this.GenerateSeries(); }
To reproduce: WaterfallSeries series = new WaterfallSeries(); series.ShowLabels = true; series.DataPoints.Add(new WaterfallDataPoint(50000, false, false, "Beginning\nBalance")); series.DataPoints.Add(new WaterfallDataPoint(17000, false, false, "Jan")); series.DataPoints.Add(new WaterfallDataPoint(14000, false, false, "Feb")); series.DataPoints.Add(new WaterfallDataPoint(-12000, false, false, "Mar")); series.DataPoints.Add(new WaterfallDataPoint(69000, true, false, "Q1")); series.DataPoints.Add(new WaterfallDataPoint(-22000, false, false, "Apr")); series.DataPoints.Add(new WaterfallDataPoint(-18000, false, false, "May")); series.DataPoints.Add(new WaterfallDataPoint(500, false, false, "Jun")); series.DataPoints.Add(new WaterfallDataPoint(-30000, true, false, "Q2")); series.DataPoints.Add(new WaterfallDataPoint(39000, false, true, "Ending\nBalance")); this.radChartView1.Series.Add(series); CartesianGridLineAnnotation annotation1 = new CartesianGridLineAnnotation(); annotation1.Label = "Annotation"; annotation1.ForeColor = Color.Lime; annotation1.BackColor = Color.Black; this.radChartView1.Annotations.Add(annotation1); Workaround: public RadForm1() { InitializeComponent(); this.radChartView1.CreateRenderer += radChartView1_CreateRenderer; WaterfallSeries series = new WaterfallSeries(); series.ShowLabels = true; series.DataPoints.Add(new WaterfallDataPoint(50000, false, false, "Beginning\nBalance")); series.DataPoints.Add(new WaterfallDataPoint(17000, false, false, "Jan")); series.DataPoints.Add(new WaterfallDataPoint(14000, false, false, "Feb")); series.DataPoints.Add(new WaterfallDataPoint(-12000, false, false, "Mar")); series.DataPoints.Add(new WaterfallDataPoint(69000, true, false, "Q1")); series.DataPoints.Add(new WaterfallDataPoint(-22000, false, false, "Apr")); series.DataPoints.Add(new WaterfallDataPoint(-18000, false, false, "May")); series.DataPoints.Add(new WaterfallDataPoint(500, false, false, "Jun")); series.DataPoints.Add(new WaterfallDataPoint(-30000, true, false, "Q2")); series.DataPoints.Add(new WaterfallDataPoint(39000, false, true, "Ending\nBalance")); this.radChartView1.Series.Add(series); CartesianGridLineAnnotation annotation1 = new CartesianGridLineAnnotation(); annotation1.Label = "Annotation"; annotation1.ForeColor = Color.Lime; annotation1.BackColor = Color.Black; annotation1.PositonOffset = new SizeF(0, -20); annotation1.Axis = this.radChartView1.Axes[1] as CartesianAxis; annotation1.Value = 70000; annotation1.BorderColor = Color.Red; annotation1.BorderDashStyle = DashStyle.Solid; annotation1.BorderWidth = 1; this.radChartView1.Annotations.Add(annotation1); } private void radChartView1_CreateRenderer(object sender, ChartViewCreateRendererEventArgs e) { e.Renderer = new CustomCartesianRenderer(e.Area as CartesianArea); } public class CustomCartesianRenderer : CartesianRenderer { public CustomCartesianRenderer(CartesianArea area) : base(area) { } protected override void Initialize() { base.Initialize(); for (int i = 0; i <= this.DrawParts.Count - 1; i++) { CartesianGridLineAnnotationDrawPart annotationPart = this.DrawParts[i] as CartesianGridLineAnnotationDrawPart; if (annotationPart != null) { this.DrawParts[i] = new CustomCartesianGridLineAnnotationDrawPart((CartesianGridLineAnnotation)annotationPart.Element, this); } } } } public class CustomCartesianGridLineAnnotationDrawPart : CartesianGridLineAnnotationDrawPart { public CustomCartesianGridLineAnnotationDrawPart(CartesianGridLineAnnotation element, CartesianRenderer renderer) : base(element, renderer) { } public override void Draw() { FieldInfo fi = typeof(CartesianGridLineAnnotation).GetField("model", BindingFlags.NonPublic | BindingFlags.Instance); ChartAnnotationModel model = fi.GetValue(this.Element) as ChartAnnotationModel; RectangleF rect = ChartRenderer.ToRectangleF(model.LayoutSlot); rect.Offset(this.ViewportOffsetX, this.ViewportOffsetY); Graphics graphics = this.Renderer.Surface as Graphics; RadGdiGraphics radGraphics = new RadGdiGraphics(graphics); Rectangle clipRect = ChartRenderer.ToRectangle(this.Element.View.GetArea<CartesianArea>().AreaModel.PlotArea.LayoutSlot); clipRect.Offset((int)this.ViewportOffsetX, (int)this.ViewportOffsetY); graphics.SetClip(clipRect); GraphicsPath path = new GraphicsPath(); path.AddLine(rect.Location, new PointF(rect.Right, rect.Bottom)); BorderPrimitiveImpl border = new BorderPrimitiveImpl(this.Element, null); border.PaintBorder(radGraphics, null, path, rect); rect.Size = graphics.MeasureString(this.Element.Label, this.Element.Font); rect.Offset(this.Element.PositonOffset.Width + 1, this.Element.PositonOffset.Height + 1); TextParams tp = new TextParams(); tp.font = this.Element.Font; tp.foreColor = this.Element.ForeColor; tp.paintingRectangle = rect; tp.text = this.Element.Label; FillPrimitiveImpl fill = new FillPrimitiveImpl(this.Element, null); fill.PaintFill(radGraphics, null, rect); TextPrimitiveHtmlImpl text = new TextPrimitiveHtmlImpl(); text.PaintPrimitive(radGraphics, 0f, new SizeF(1f, 1f), tp); } }
How to reproduce: explicitly set the border color of the series Workaround: public partial class Form1 : Form { private RangeSelectorViewElement chartElement; public Form1() { InitializeComponent(); LineSeries lineSeries = new LineSeries(); lineSeries.Name = "Line"; lineSeries.BorderColor = Color.Green; lineSeries.DataPoints.Add(new CategoricalDataPoint(20, "Jan")); lineSeries.DataPoints.Add(new CategoricalDataPoint(22, "Apr")); lineSeries.DataPoints.Add(new CategoricalDataPoint(12, "Jul")); lineSeries.DataPoints.Add(new CategoricalDataPoint(19, "Oct")); this.radChartView1.Series.Add(lineSeries); this.chartElement = this.radRangeSelector1.RangeSelectorElement.AssociatedElement as RangeSelectorViewElement; this.chartElement.SeriesInitialized += ChartElement_SeriesInitialized; } private void ChartElement_SeriesInitialized(object sender, SeriesInitializedEventArgs e) { if (e.Series.Name == "Line") { e.Series.BorderColor = this.radChartView1.Series.Where(s => s.Name == "Line").First().BorderColor; } } }
Use LogarithmicAxis and set the Minimum to 0.1 Workaround is availble in the atched project.