To reproduce: DataTable table = new DataTable(); table.Columns.Add("CategoryName"); table.Columns.Add("Sales"); table.Rows.Add("Beverages", 102074.31); table.Rows.Add("Condiments", 55277.6); table.Rows.Add("Confections", 80894.14); table.Rows.Add("Diary Products", 114749.78); table.Rows.Add("Grains/Cereals", 55948.82); table.Rows.Add("Meat/Poultry", 81338.06); table.Rows.Add("Produce", 53019.98); table.Rows.Add("Seafood", 65544.18); var result = table.AsEnumerable().Take(5); this.radChartView1.AreaType = ChartAreaType.Pie; PieSeries series = new PieSeries(); radChartView1.Series.Add(series); series.ShowLabels = true; series.ValueMember = "Sales"; series.DisplayMember = "CategoryName"; series.DataSource = result.ToList(); The last row will produce invalid binding. Here is a valid binding in this scenario: using System; using System.Data; using System.Linq; using System.Windows.Forms; using Telerik.WinControls.UI; namespace Lab.Chart { public partial class ChartBindToEnumerableForm : Form { private RadChartView chartView = new RadChartView(); public ChartBindToEnumerableForm() { InitializeComponent(); chartView.Dock = DockStyle.Fill; chartView.Parent = this; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); DataTable table = new DataTable(); table.Columns.Add("CategoryName"); table.Columns.Add("Sales"); table.Rows.Add("Beverages", 5); table.Rows.Add("Condiments", 5); table.Rows.Add("Confections", 4); table.Rows.Add("Diary Products", 4); table.Rows.Add("Grains/Cereals", 23); table.Rows.Add("Meat/Poultry", 2); table.Rows.Add("Produce", 1); table.Rows.Add("Seafood", 3); var result = table.AsEnumerable().Take(5); chartView.AreaType = ChartAreaType.Cartesian; BarSeries series = new BarSeries(); chartView.Series.Add(series); series.ShowLabels = true; series.ValueMember = "Sales"; series.CategoryMember = series.DisplayMember = "CategoryName"; //series.DataSource = result.ToList(); WRONG WAY!!!, produce list of DataRows, which related to DataTable, DataView implementation of custom PropertyDescriptoCollection will generated errors and invalid binding for all list binding controls: grid, list, combo, chart, listview series.DataSource = result.CopyToDataTable(); } } }
FIX. RadChartView - the Arctic palette menu item appears twice in the context menu
Add BarSeries with several CategoricalDataPoint with some long category text. Change the chart's area orientation, then you will notice that the AxisLabelElements overlaps the axis
To reproduce: Add a RadChartView to a Form. Use the following code: this.Chart.AreaType = ChartAreaType.Pie; this.Chart.ShowLegend = true; PieSeries series = new PieSeries(); series.DataPoints.Add(new PieDataPoint(50, "Germany")); series.DataPoints.Add(new PieDataPoint(70, "United States")); series.DataPoints.Add(new PieDataPoint(40, "France")); series.DataPoints.Add(new PieDataPoint(25, "United Kingdom")); series.ShowLabels = true; this.Chart.Series.Add(series); Workaround: Private Sub LegendElement_VisualItemCreating(sender As Object, e As LegendItemElementCreatingEventArgs) Dim pieElement As PiePointElement = DirectCast(e.LegendItem.Element, PiePointElement) Dim dataPoint As PieDataPoint = DirectCast(pieElement.DataPoint, PieDataPoint) e.LegendItem.Title = dataPoint.Name End Sub
When one adds data points with negative and positive values, the negative ones should go below the 0, for example, with the following data: AreaSeries areaSeries = new AreaSeries(); areaSeries.DataPoints.Add(new CategoricalDataPoint(5, "Jan")); areaSeries.DataPoints.Add(new CategoricalDataPoint(-10, "Apr")); Resolution: To use the functionality one should set the StartPositionAxis and StartPositionValue properties of an axis. The first property is the axis along which the current axis will be aligned. The second is the value where the current axis should be positioned. Here is a sample code: AreaSeries areaSeries = new AreaSeries(); areaSeries.DataPoints.Add(new CategoricalDataPoint(13, "Jan")); areaSeries.DataPoints.Add(new CategoricalDataPoint(20, "Apr")); areaSeries.DataPoints.Add(new CategoricalDataPoint(-15, "Jul")); areaSeries.DataPoints.Add(new CategoricalDataPoint(16, "Oct")); this.radChartView1.Series.Add(areaSeries); areaSeries.HorizontalAxis.StartPositionAxis = areaSeries.VerticalAxis; areaSeries.HorizontalAxis.StartPositionValue = 0;
To reproduce: Setup the following RadChartView: this.Chart.ShowLegend = true; this.Chart.Series.Add(new LineSeries() { LegendTitle = "DDDD" }); this.Chart.ChartElement.LegendElement.Items[0].Element.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; for (int i = 0; i < 10; i++) { this.Chart.Series[0].DataPoints.Add(i); } You will see that although that you have changed the BorderDashStyle of the Element, the LineSerie will be drawn normally.
Add the ability a user to be able to use a Custom DashStyle in the following scenario: this.Chart.ShowLegend = true; this.Chart.Series.Add(new LineSeries() { LegendTitle = "DDDD" }); this.Chart.ChartElement.LegendElement.Items[0].Element.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Custom; for (int i = 0; i < 10; i++) { this.Chart.Series[0].DataPoints.Add(i); } The following article describes how to use a Custom DashStyle: How to: Draw a Custom Dashed Line
To reproduce: Use the following code with RadChartView: this.Chart.Series.Add(new LineSeries()); for (int i = 0; i < 50; i++) { if (i == 10) { this.Chart.Series[0].DataPoints.Add(new CategoricalDataPoint(1)); continue; } this.Chart.Series[0].DataPoints.Add(new CategoricalDataPoint(0)); } this.Chart.ShowGrid = true; You will see that the point will not be rendered correctly and will be taller than 1.
With significant number of points in pie series and with very small values as data points, the default chart strategy for positioning smart labels overlaps the values. Note: the smart labels overlapping can be reproduced with DonutSeries as well.
To reproduce: You need a RadChartView with some series. You need to add a new View - radChartView1.Views.AddNew("Bigger"); You also need to add a DrillDownController: DrillDownController drillcontrol = new DrillDownController(); radChartView1.Controllers.Add(drillcontrol); radChartView1.ShowDrillNavigation = true; On the Drill event of RadChartView you need to reload the chart. This must clear the axes on the current view (determined by the drill level) and add new ones. You will see that the legend will not update. Additional details can be found in the attached project. Workaround: Re-add the legend items manually: private void radChartView1_Drill(object sender, DrillEventArgs e) { if (e.Level == 0) BiggerView = false; else BiggerView = true; ReloadChart(); this.radChartView1.ChartElement.LegendElement.StackElement.Children.Clear(); ChartView currentView = this.radChartView1.Views[BiggerView ? 1 : 0]; foreach (ChartSeries series in currentView.Series) { LegendItem item = new LegendItem(series) { Title = series.Name }; LegendItemElement element = new LegendItemElement(item); this.radChartView1.ChartElement.LegendElement.StackElement.Children.Add(element); } }
To reproduce: use the following code snippet public Form1() { InitializeComponent(); ScatterLineSeries scatterSeries = new ScatterLineSeries(); scatterSeries.DataPoints.Add(new ScatterDataPoint(15, 19)); scatterSeries.DataPoints.Add(new ScatterDataPoint(18, 10)); scatterSeries.DataPoints.Add(new ScatterDataPoint(13, 15)); scatterSeries.DataPoints.Add(new ScatterDataPoint(10, 8)); scatterSeries.DataPoints.Add(new ScatterDataPoint(5, 2)); scatterSeries.PointSize = new SizeF(8, 8); this.radChartView1.Series.Add(scatterSeries); ScatterLineSeries scatterSeries2 = new ScatterLineSeries(); scatterSeries2.DataPoints.Add(new ScatterDataPoint(2, 24)); scatterSeries2.DataPoints.Add(new ScatterDataPoint(7, 12)); scatterSeries2.DataPoints.Add(new ScatterDataPoint(15, 10)); scatterSeries2.DataPoints.Add(new ScatterDataPoint(18, 22)); scatterSeries2.DataPoints.Add(new ScatterDataPoint(20, 20)); scatterSeries2.Shape = new RoundRectShape(1); scatterSeries2.PointSize = new SizeF(8, 8); this.radChartView1.Series.Add(scatterSeries2); ChartTooltipController toolTipController = new ChartTooltipController(); radChartView1.Controllers.Add(toolTipController); } Workaround: use custom renderer public Form1() { InitializeComponent(); this.radChartView1.CreateRenderer += radChartView1_CreateRenderer; } 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++) { ScatterSeriesDrawPart scatterPart = this.DrawParts[i] as ScatterSeriesDrawPart; if (scatterPart != null) { this.DrawParts[i] = new CustomScatterSeriesDrawPart((ScatterLineSeries)scatterPart.Element, this); } } } } public class CustomScatterSeriesDrawPart : ScatterLineSeriesDrawPart { public CustomScatterSeriesDrawPart(ScatterLineSeries series, IChartRenderer renderer) : base(series, renderer) { } public override DataPoint HitTest(Point location) { for (int i = 0; i < this.Element.DataPoints.Count; i++) { RadRect slot = this.Element.DataPoints[i].LayoutSlot; float pointHalfWidth = this.Element.PointSize.Width / 2; float pointHalfHeight = this.Element.PointSize.Height / 2; RectangleF scatterBounds = new RectangleF((float)(this.OffsetX + slot.X - pointHalfWidth), (float)(this.OffsetY + slot.Y - pointHalfHeight), this.Element.PointSize.Width, this.Element.PointSize.Height); if (scatterBounds.Contains(location.X, location.Y)) { return this.Element.DataPoints[i]; } } return null; } }
so that Y increases as you move down the screen. (Even) microsoft chart component supports this.
To reproduce: Add a RadChartView and use the following code: public Form1() { InitializeComponent(); this.radChartView1.ShowTrackBall = true; this.radChartView1.ShowLegend = true; Random rand = new Random(); var lineSeries = new LineSeries(); for (int i = 0; i < 1000; i++) { lineSeries.DataPoints.Add(new CategoricalDataPoint(i, rand.Next(0, rand.Next(5, 20)))); } radChartView1.Series.Add(lineSeries); } Workaround: change the LegendPosition: this.radChartView1.ChartElement.LegendPosition = LegendPosition.Bottom;
ADD. RadChartView - add waterfall series type.
To reproduce: Create a RadChartView with LineSeries. Subscribe to the CreatePointElement event and use the following code: void Chart_CreatePointElement(object sender, ChartViewCreatePointElementEventArgs e) { e.DataPointElement = new DataPointElement(e.DataPoint); e.DataPointElement.GradientStyle = GradientStyles.Solid; e.DataPointElement.GradientAngle = 270; e.DataPointElement.Shape = new DiamondShape(); e.DataPointElement.BackColor = Color.Red; e.DataPointElement.BackColor2 = Color.Blue; e.DataPointElement.BackColor3 = Color.Blue; e.DataPointElement.BackColor4 = Color.Blue; } The elements paint when you use ChamferedRectShape. Workaround class MyDiamondShape : ElementShape { public override GraphicsPath CreatePath(Rectangle bounds) { GraphicsPath path = new GraphicsPath(); path.AddPolygon(new PointF[] { new PointF(bounds.X + 0.5f * bounds.Width, bounds.Top), new PointF(bounds.Right, bounds.Y + 0.5f * bounds.Height), new PointF(bounds.X + 0.5f * bounds.Width, bounds.Bottom), new PointF(bounds.Left, bounds.Y + 0.5f * bounds.Height) }); return path; } } class MyStarShape : ElementShape { private int arms; private float innerRadiusRatio; public MyStarShape() { this.arms = 8; this.innerRadiusRatio = 0.2f; } /// <summary> /// Creates Star like shape. Overrides CreatePath method in the base class /// ElementShape. /// </summary> public override GraphicsPath CreatePath(Rectangle bounds) { GraphicsPath path = new GraphicsPath(); double angle = Math.PI / arms; double offset = Math.PI / 2d; PointF center = new PointF(bounds.X + bounds.Width / 2f, bounds.Y + bounds.Height / 2f); PointF[] points = new PointF[arms * 2]; for (int i = 0; i < 2 * arms; i++) { float r = (i & 1) == 0 ? bounds.Width / 2f : bounds.Width / 2f * innerRadiusRatio; float currX = center.X + (float)Math.Cos(i * angle - offset) * r; float currY = center.Y + (float)Math.Sin(i * angle - offset) * r; points[i] = new PointF(currX, currY); } path.AddPolygon(points); return path; } } class MyHeartShape : ElementShape { public override GraphicsPath CreatePath(Rectangle bounds) { GraphicsPath path = new GraphicsPath(); path.AddArc(new Rectangle(bounds.X, bounds.Y, bounds.Width / 2, bounds.Height / 2), 150, 210); path.AddArc(new Rectangle(bounds.X + bounds.Width / 2, bounds.Y, bounds.Width / 2, bounds.Height / 2), 180, 210); path.AddLine(path.GetLastPoint(), new Point(bounds.X + bounds.Width / 2, bounds.Bottom)); path.CloseFigure(); return path; } }
To reproduce: use the following code snippet: Random rand = new Random(); List<LineSeries> list = new List<LineSeries>(); for (int i = 0; i < 15; i++) { LineSeries ls = new LineSeries(); ls.LegendTitle = "Series" + i; list.Add(ls); } for (int i = 0; i < 1000; i++) { foreach (LineSeries s in list) { s.DataPoints.Add(new CategoricalDataPoint(i, rand.Next(0, rand.Next(5, 20)))); } } radChartView1.Series.AddRange(list.ToArray()); this.radChartView1.ChartElement.LegendPosition = LegendPosition.Bottom; this.radChartView1.ChartElement.LegendElement.StackElement.Orientation = Orientation.Horizontal; Resolution: The issue is duplicated with item IMPROVE. RadChartView - ChartLegend should be able to wrap its items. From Q1 2015 when there are many items in the chart legend a scroll bar will appear so users can scroll through the items. More info in the following feedback item http://feedback.telerik.com/Project/154/Feedback/Details/149848-add-radchartview-when-the-legend-has-many-items-a-scrollbar-should-appear
To reproduce: Create a RadChartView, add a ZoomController and set the ShowGrid property to true: 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(11, 4)); chart.Series.Add(series); chart.Controllers.Add(new LassoZoomController()); chart.ShowGrid = true; You will see that the grid is painted outside of the chart area where the points are
To reproduce use the following code: public Form1() { InitializeComponent(); radChartView1.AreaType = Telerik.WinControls.UI.ChartAreaType.Pie; radChartView1.ShowLegend = true; series.ValueMember = "CategoryID"; series.DisplayMember = "CategoryName"; series.DataSource = this.nwindDataSet1.Categories; radChartView1.Series.Add(series); } private void radButton1_Click(object sender, EventArgs e) { this.categoriesTableAdapter.Fill(this.nwindDataSet1.Categories); } private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'nwindDataSet1.Categories' table. You can move, or remove it, as needed. this.categoriesTableAdapter.Fill(this.nwindDataSet1.Categories); } Workaround: - Clear the items manually: this.radChartView1.ChartElement.LegendElement.StackElement.Children.Clear();
Inside the constructor of a form create a pie series and populate it with data. Then add it to a RadChartView. You will notice that there are two legend items per data point.