Adding a series with null values and combine mode Stack or Stack100 results in an exception.
Currently the PieRenderer class is private and cannot be inherited nor extended. All other renderer classes are public.
To reproduce: public partial class Form1 : Form { private BindingList<MyData> data; public Form1() { InitializeComponent(); LoadDatas(); MyBarSeries bars = new MyBarSeries(); bars.DataSource = data; bars.ValueMember = "Montant"; bars.CategoryMember = "Month"; bars.LegendTitle = "My series of MyData"; this.radChartView1.ShowLegend = true; this.radChartView1.Series.Add(bars); } private void LoadDatas() { data = new BindingList<MyData>(); data.Add(new MyData(20, "janv", 1)); data.Add(new MyData(50, "fev", 2)); data.Add(new MyData(30, "mars", 3)); data.Add(new MyData(25, "avril", 4)); data.Add(new MyData(40, "mai", 5)); data.Add(new MyData(80, "juin", 6)); data.Add(new MyData(20, "juil", 7)); } public class MyData { public int Montant { get; set; } public string Month { get; set; } public double NumMonth { get; set; } public MyData(int montant, string month, double numMonth) { this.Montant = montant; this.Month = month; this.NumMonth = numMonth; } } public class MyBarSeries : BarSeries { } } Resolution: When you inherit from a serie, the original control themes are not automatically inherited. You need to override the ThemeRole property. Here is the code snippet: public class MyBarSeries : BarSeries { public override string ThemeRole { get { return typeof(BarSeries).Name; } } }
Telerik.Charting namespace exist in the WinForms and the WFP assemblies and one cannot reference both in a single project.
Currently, when you zoom in and out, the position the mouse is initially hovering is not kept, while it should
The lasso controller should zoom vertically as well.
Steps to reproduce: 1. Add a RadChartView to a form. 2. Add a LassoZoomController to the chart 3. Run the project and start scrolling the mouse wheel. You will see that the chart is not zoomed in our out. If you click on the chart the mouse wheel zooms as expected. WORKAROUND: Set the focus to the chart element: this.radChartView1.Behavior.ItemCapture = this.radChartView1.ChartElement; this.radChartView1.ChartElement.Focus();
Add Range series similar to those provided by WPF/SL http://demos.telerik.com/silverlight/#ChartView/Gallery/Range
To reproduce: SteplineSeries stepLineSeries = new SteplineSeries(); stepLineSeries.DataPoints.Add(new CategoricalDataPoint(12, "Jan")); stepLineSeries.DataPoints.Add(new CategoricalDataPoint(42, "Apr")); stepLineSeries.DataPoints.Add(new CategoricalDataPoint(28, "Jul")); stepLineSeries.DataPoints.Add(new CategoricalDataPoint(12, "Oct")); this.radChartView1.Series.Add(stepLineSeries); CartesianArea area = this.radChartView1.Area as CartesianArea ; area.Orientation = Orientation.Horizontal; Please refer to the attached screenshots. Workaround: use LineSeries with custom CartesianRenderer: public Form1() { InitializeComponent(); this.radChartView1.CreateRenderer += radChartView1_CreateRenderer; LineSeries lineSeries = new LineSeries(); lineSeries.DataPoints.Add(new CategoricalDataPoint(12, "Jan")); lineSeries.DataPoints.Add(new CategoricalDataPoint(42, "Apr")); lineSeries.DataPoints.Add(new CategoricalDataPoint(28, "Jul")); lineSeries.DataPoints.Add(new CategoricalDataPoint(12, "Oct")); this.radChartView1.Series.Add(lineSeries); CartesianArea area = this.radChartView1.Area as CartesianArea ; area.Orientation = Orientation.Horizontal; } private void radChartView1_CreateRenderer(object sender, ChartViewCreateRendererEventArgs e) { e.Renderer = new CustomCartesianRenderer((CartesianArea)e.Area); } 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++) { LineSeriesDrawPart drawPart = this.DrawParts[i] as LineSeriesDrawPart; if (drawPart != null) { this.DrawParts[i] = new CustomLineDrawPart((LineSeries)drawPart.Element, this); } } } } public class CustomLineDrawPart : LineSeriesDrawPart { public CustomLineDrawPart(LineSeriesBase series, IChartRenderer renderer) : base(series, renderer) { } protected override GraphicsPath GetLinePaths(PointF[] points) { GraphicsPath path = new GraphicsPath(); PointF x; PointF y; List<PointF> pointsList = points.ToList(); CartesianArea area = this.Element.Parent as CartesianArea; if (area != null && area.Orientation == Orientation.Horizontal) { pointsList = pointsList.OrderBy(p => p.Y).ThenBy(p => p.X).ToList(); } if (pointsList.Count > 1) { for (int i = 1; i < pointsList.Count; i++) { x = pointsList[i - 1]; y = pointsList[i]; path.AddLine(x.X, x.Y, y.X, x.Y); path.AddLine(y.X, x.Y, y.X, y.Y); } } else { return null; } return path; } }
To reproduce: protected override void OnLoad(EventArgs e) { base.OnLoad(e); InitializeComponent(); radChartView1 = new RadChartView(); this.Controls.Add(radChartView1); DateTimeContinuousAxis asseX = new DateTimeContinuousAxis(); LinearAxis asseY = new LinearAxis(); asseY.AxisType = AxisType.Second; asseY.Minimum = 0; asseY.Maximum = 200; asseY.HorizontalLocation = Telerik.Charting.AxisHorizontalLocation.Right; asseY.LabelFormat = "{0} °C"; LineSeries serie = new LineSeries(); serie.DataPoints.Add(new CategoricalDataPoint(150, DateTime.Now)); serie.VerticalAxis = asseY; serie.HorizontalAxis = asseX; radChartView1.Series.Add(serie); } Workaround is available in the attached project.
Add several data points with date time objects as their categories. Make sure the time span these date time objects is within a few seconds. You will see that not all labels will be displayed by the chart.
When the legend has many items a scrollbar should appear.
To reproduce: BarSeries barSeries = new BarSeries("Performance", "RepresentativeName"); barSeries.Name = "Q1"; barSeries.DataPoints.Add(new CategoricalDataPoint(1000000, "Harley Harley Harley Harley Smith")); barSeries.DataPoints.Add(new CategoricalDataPoint(2000000, "White")); barSeries.DataPoints.Add(new CategoricalDataPoint(3000000, "Smith Smith Smith Smith Smith mith Smith Harley")); barSeries.DataPoints.Add(new CategoricalDataPoint(4000000, "Jones")); barSeries.DataPoints.Add(new CategoricalDataPoint(5000000, "Marshall")); this.radChartView1.Series.Add(barSeries); this.radChartView1.GetArea<CartesianArea>().Orientation = Orientation.Horizontal; LinearAxis horizontalAxis = radChartView1.Axes.Get<LinearAxis>(1); horizontalAxis.ClipLabels = false; Workaround: 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++) { AxisLabelDrawPart part = this.DrawParts[i] as AxisLabelDrawPart; if (part != null) { this.DrawParts[i] = new CustomDrawPart((Axis)part.Element, this); } } } } public class CustomDrawPart : AxisLabelDrawPart { public CustomDrawPart(Axis axis, IChartRenderer renderer) :base( axis, renderer) {} protected override void DrawNoneAndMultiLineLabelElements() { //base.DrawNoneAndMultiLineLabelElements(); if (!this.Element.ShowLabels || this.Element.Children.Count == 0) { return; } Graphics graphics = this.Renderer.Surface as Graphics; RadGdiGraphics radGraphics = new RadGdiGraphics(graphics); RadRect plotRect = this.Element.Model.LayoutSlot; plotRect.X += this.ViewportOffsetX; plotRect.Y += this.ViewportOffsetY; CartesianAxis axis = this.Element as CartesianAxis; SizeF offset = SizeF.Empty; if (axis != null) { offset = ((CartesianRenderer)this.Renderer).GetAxisOffset(axis); if (axis.ClipLabels) { SizeF size = graphics.MeasureString("W", this.Element.Font); RectangleF clipRect = ChartRenderer.ToRectangleF(plotRect); clipRect.Y -= size.Height / 2f; clipRect.Height += size.Height; clipRect.X -= size.Width; clipRect.Width += size.Width * 2f; clipRect.Offset(offset.ToPointF()); graphics.SetClip(clipRect); } } using (SolidBrush brush = new SolidBrush(Color.Empty)) { foreach (UIChartElement element in this.Element.Children) { AxisLabelElement labelElement = element as AxisLabelElement; if (labelElement == null || !labelElement.IsVisible) { continue; } string text = labelElement.Text; if (string.IsNullOrEmpty(text)) { continue; } labelElement.OnAxisLabelFormatting(new ChartAxisLabelFormattingEventArgs(labelElement)); RadRect slot = labelElement.GetLayoutSlot(); if (this.Element is CartesianAxis) { slot.X += this.ViewportOffsetX; slot.Y += this.ViewportOffsetY; } if (this.Element.AxisType == AxisType.First) { slot.X += (float)((IChartView)this.Element.View).PlotOriginX; } else { slot.Y += (float)((IChartView)this.Element.View).PlotOriginY; } RectangleF rect = ChartRenderer.ToRectangleF(slot); if (axis != null) { rect.Offset(offset.ToPointF()); } if (labelElement.BackgroundShape != null) { labelElement.BackgroundShape.Paint((Graphics)radGraphics.UnderlayGraphics, rect); } FillPrimitiveImpl fill = new FillPrimitiveImpl(labelElement, null); fill.PaintFill(radGraphics, 0, Size.Empty, rect); BorderPrimitiveImpl border = new BorderPrimitiveImpl(labelElement, null); border.PaintBorder(radGraphics, 0, Size.Empty, rect); if (brush.Color != labelElement.ForeColor) { brush.Color = labelElement.ForeColor; } StringFormat sf = StringFormat.GenericTypographic; sf.Alignment = StringAlignment.Near; graphics.DrawString(text, labelElement.Font, Brushes.Black, rect.Location, sf); } } } }
Steps to reproduce: 1. Add a chart to a form. 2. Add and remove series continuously. 3. The memory of the project will only raise and memory will not be freed. WORKAROUND*: Clear the data points of the series that is/are removed from the chart. *Although this will significantly reduce the memory consumption it will not eliminate the memory leak. There will still be a small portion of retained memory.
To reproduce: LineSeries dailySeries = new LineSeries(); dailySeries.BorderColor = Color.DarkBlue; dailySeries.BorderWidth = 1; dailySeries.PointSize = new SizeF(5, 5); dailySeries.ShowLabels = true; for (int i = 0; i < 100; i++) { dailySeries.DataPoints.Add(new CategoricalDataPoint(rnd.Next(100), DateTime.Now.AddMonths(i)) { Label = "old" }); } DateTimeCategoricalAxis categoricalAxis = new DateTimeCategoricalAxis(); categoricalAxis.DateTimeComponent = DateTimeComponent.Date; categoricalAxis.MajorTickInterval = 10; categoricalAxis.PlotMode = AxisPlotMode.OnTicks; categoricalAxis.LabelFormat = "{0:MMM-yy}"; categoricalAxis.ClipLabels = false; categoricalAxis.LastLabelVisibility = AxisLastLabelVisibility.Visible; CartesianArea area = this.radChart.GetArea<CartesianArea>(); area.ShowGrid = true; CartesianGrid grid = area.GetGrid<CartesianGrid>(); grid.DrawHorizontalFills = true; grid.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.DashDot; //First assign the axis to the VerticalAxis property and then add the series to the chart dailySeries.HorizontalAxis = categoricalAxis; this.radChart.Series.Add(dailySeries); Workaround: Use different value for the MajorTickInterval.