If one adds a RadChartView to a form and set its Visibility property to false or creates a chart in memory and tries to export it to an image the result would not look as expected.
To reproduce: Add horizontal bar series bind to the following data: myList = new BindingList<MyCustomObject>(); myList.Add(new MyCustomObject(1, "Outdoor")); myList.Add(new MyCustomObject(0, "Hardware")); myList.Add(new MyCustomObject(0, "Tools")); myList.Add(new MyCustomObject(1, "Books")); myList.Add(new MyCustomObject(1, "Appliances")); Workaround: LinearAxis verticalAxis = new LinearAxis(); verticalAxis.LabelFitMode = AxisLabelFitMode.Rotate; verticalAxis.LabelRotationAngle = 0.1; verticalAxis.Minimum = 0; verticalAxis.Maximum = 2;
Workaround: public Form1() { InitializeComponent(); StringFormat.GenericTypographic.Alignment = StringAlignment.Near; }
To reproduce: this.radChartView1.AreaType = Telerik.WinControls.UI.ChartAreaType.Polar; RadarLineSeries series = new RadarLineSeries(new SizeF(8f, 8f)); series.DataPoints.Add(new CategoricalDataPoint(0.0, "Coding")); series.LegendTitle = String.Format("Coding"); series.BorderWidth = 2; radChartView1.Series.Add(series); series.PolarAxis.Minimum = 0d; series.PolarAxis.Maximum = 0.0; series.PolarAxis.TickLength = 4;
To reproduce: public Form1() { InitializeComponent(); this.radChartView1.ShowPanZoom = true; Random rand = new Random(); this.radChartView1.AreaType = ChartAreaType.Polar; for (int i = 0; i < 85; i++) { RadarLineSeries radarPointSeries = new RadarLineSeries(); for (int j = 0; j < 8; j++) { radarPointSeries.DataPoints.Add(new CategoricalDataPoint(rand.Next(1, 100), "X" + j)); } this.radChartView1.Series.Add(radarPointSeries); } } Workaround: set the ShowPanZoom property after the chart is populated with data.
To reproduce: public Form1() { InitializeComponent(); this.radChartView1.AreaType = ChartAreaType.Polar; Random rand = new Random(); for (int i = 0; i < 80; i++) { RadarLineSeries s = new RadarLineSeries(); s.ShowLabels = true; for (int j = 0; j < 8; j++) { s.DataPoints.Add(new CategoricalDataPoint(rand.Next(1, 100), "X" + j)); } this.radChartView1.Series.Add(s); } this.radChartView1.ShowSmartLabels = true; }
To reproduce: public Form1() { InitializeComponent(); Random rand = new Random(); for (int i = 0; i < 3; i++) { LineSeries lineSeries = new LineSeries(); lineSeries.DataPoints.Add(new CategoricalDataPoint(rand.Next(-50, 50), "Jan")); lineSeries.DataPoints.Add(new CategoricalDataPoint(rand.Next(-50, 50), "Apr")); lineSeries.DataPoints.Add(new CategoricalDataPoint(rand.Next(-50, 50), "Jul")); lineSeries.DataPoints.Add(new CategoricalDataPoint(rand.Next(-50, 50), "Oct")); this.radChartView1.Series.Add(lineSeries); } this.radChartView1.ShowLegend = true; this.radChartView1.ChartElement.LegendPosition = LegendPosition.Bottom; ((LineSeries)this.radChartView1.Series[0]).LegendTitle = "S&P 500"; ((LineSeries)this.radChartView1.Series[1]).LegendTitle = "MSCI Emerging Markets TR Index"; ((LineSeries)this.radChartView1.Series[2]).LegendTitle = "Great ETF"; } Workaround: Font f = new Font("Times New Roman", 10f, FontStyle.Regular); private void Form1_Load(object sender, EventArgs e) { foreach (LegendItemElement item in this.radChartView1.ChartElement.LegendElement.StackElement.Children) { item.Font = f; } }
The trackball does not work well when charting the dxf cad drawing of a circle or more complex shape would be better for it to have cross hair mode, as single point mode does not work (as it picks up a massive array of x,y points in the tooltip, making it unmanageable) Showtrackball = true SelectionMode = SingleDataPoint
How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radChartView1.AreaType = ChartAreaType.Pie; PieSeries series = new PieSeries(); series.DataPoints.Add(new PieDataPoint(0, "Germany")); series.DataPoints.Add(new PieDataPoint(0, "United States")); series.DataPoints.Add(new PieDataPoint(0, "France")); series.DataPoints.Add(new PieDataPoint(0, "United Kingdom")); series.ShowLabels = true; this.radChartView1.Series.Add(series); this.radChartView1.ShowSmartLabels = true; } } Workaround: this.radChartView1.ShowSmartLabels = false;
There are three ways in which null values can be handled: 1 . Zero. When this option is used, each null value is replaced with a zero. The data entry is not removed from the data collection. Only its original null/empty value is replaced with zero. 2 . Gap. This option visually removes the regions for each set of empty(null) points. The data entry is not removed from the data collection. Essentially, it connects the points neighboring the null point (or the collection of empty values). 3 . Drop - this option clips, or visually removes each section/segment, corresponding to a set of empty points/values.
To reproduce: radChartView1.AreaType = ChartAreaType.Pie; PieSeries series = new PieSeries(); series.DataPoints.Add(new PieDataPoint(50, "Germany")); series.Children.LastOrDefault().BackColor = Color.Red; series.Children.LastOrDefault().BorderColor = Color.Green; series.DataPoints.Add(new PieDataPoint(70, "United States")); series.Children.LastOrDefault().BackColor = Color.Green; series.Children.LastOrDefault().BorderColor = Color.Red; series.DataPoints.Add(new PieDataPoint(40, "France")); series.Children.LastOrDefault().BackColor = Color.Blue; series.Children.LastOrDefault().BorderColor = Color.Yellow; series.DataPoints.Add(new PieDataPoint(25, "United Kingdom")); series.Children.LastOrDefault().BackColor = Color.Yellow; series.Children.LastOrDefault().BorderColor = Color.Blue; this.radChartView1.Series.Add(series); radChartView1.ShowLegend = true; Workaround: for (int i = 0; i < radChartView1.ChartElement.LegendElement.Items.Count; i++) { PieDataPoint point = ((PieDataPoint)series.DataPoints[i]); radChartView1.ChartElement.LegendElement.Items[i].Element.BackColor = Color.Red; radChartView1.ChartElement.LegendElement.Items[i].Element.BorderColor = Color.Yellow; }
To reproduce: - Subscribe to the SelectedPointChanged event and show a dialog in it. - Start the chart and zoom in. Select a point, close the dialog and select a point again. Workaround: class MyChartSelectionController : ChartSelectionController { protected override ActionResult OnMouseDown(MouseEventArgs e) { //return base.OnMouseDown(e); return Controller.Empty; } protected override ActionResult OnMouseUp(MouseEventArgs e) { if (!this.AllowSelect || this.SelectionMode == ChartSelectionMode.None) { return base.OnMouseUp(e); } DataPoint oldDataPoint = SelectedPoint; DataPoint newDataPoint = null; ChartSeries oldSeries = SelectedSeries; ChartSeries newSeries = null; DataPoint point = null; foreach (ChartSeries series in this.Area.Series) { point = series.HitTest(e.X, e.Y); if (point != null) { newDataPoint = point; newSeries = series; break; } } if (point == null) { return base.OnMouseUp(e); } ChartViewSelectedPointChangingEventArgs cancelArgs = new ChartViewSelectedPointChangingEventArgs(oldDataPoint, newDataPoint, oldSeries, newSeries, this.SelectionMode); OnSelectedPointChanging(cancelArgs); if (cancelArgs.Cancel == true) { return base.OnMouseUp(e); } if (oldDataPoint == newDataPoint) { oldDataPoint.IsSelected = !oldDataPoint.IsSelected; newDataPoint = null; SelectedPoint = null; } else { if (this.SelectionMode == ChartSelectionMode.SingleDataPoint && oldDataPoint != null) { oldDataPoint.IsSelected = false; } this.SelectedPoint = newDataPoint; this.SelectedPoint.IsSelected = !SelectedPoint.IsSelected; } ChartViewSelectedPointChangedEventArgs changedArgs = new ChartViewSelectedPointChangedEventArgs(oldDataPoint, newDataPoint, oldSeries, newSeries, this.SelectionMode); OnSelectedPointChanged(changedArgs); return base.OnMouseUp(e); } }
To reproduce: - Enable the Trackball - Use the following code: public RadForm1() { InitializeComponent(); ScatterLineSeries sls = radChartView1.Series[0] as ScatterLineSeries; sls.XValueMember = "X"; sls.YValueMember = "Y"; } private void timer1_Tick(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("X", typeof(double)); dt.Columns.Add("Y", typeof(double)); Random ran = new Random(); for (int i = 0; i < 100; i++) dt.Rows.Add(i, 1 + ran.NextDouble() / 10); radChartView1.Series[0].DataSource = dt; } Workaround: class MyChartTrackballController : ChartTrackballController { protected override string GetPointText(DataPoint point) { ChartSeries series = point.Presenter as ChartSeries; if (series == null) { return string.Empty; } return base.GetPointText(point); } }
To reproduce: public RadForm1() { InitializeComponent(); this.radChartView1.AreaType = ChartAreaType.Pie; 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.radChartView1.Series.Add(series); radChartView1.ShowLegend = true; } Random rnd = new Random(); private void radButton1_Click(object sender, EventArgs e) { this.radChartView1.Series[0].DataPoints.RemoveAt(0); this.radChartView1.Series[0].DataPoints.Add(new PieDataPoint(rnd.Next(100), rnd.Next(100).ToString())); } Workaround: private void radButton1_Click(object sender, EventArgs e) { this.radChartView1.Series[0].DataPoints.RemoveAt(0); this.radChartView1.Series[0].DataPoints.Add(new PieDataPoint(50, rnd.Next(100).ToString())); this.radChartView1.ChartElement.LegendElement.Items.Clear(); foreach (PieSeries series in radChartView1.Series) { for (int i = 0; i < series.DataPoints.Count; i++) { var dataPoint = series.DataPoints[i] as PieDataPoint; var element = series.Children[i] as PiePointElement; var legendItem = new LegendItem(element); legendItem.Title = dataPoint.LegendTitle; this.radChartView1.ChartElement.LegendElement.Items.Add(legendItem); } } }
To reproduce: - Use the attached file to reproduce. Workaround: - Reset the chart data source: THIS-OBJECT:radChartView1:DataSource = ?. THIS-OBJECT:radChartView1:DataSource = THIS-OBJECT:bindingSource1.
Workaround: use the ChartTrackerballController.TextNeeded event.
To reproduce: BarSeries barSeries = new BarSeries("Performance", "RepresentativeName"); barSeries.Name = "Q1"; barSeries.CombineMode = ChartSeriesCombineMode.Stack; 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.CombineMode = ChartSeriesCombineMode.Stack; 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); BarSeries barSeries3 = new BarSeries("Performance", "RepresentativeName"); barSeries3.Name = "Q3"; barSeries3.CombineMode = ChartSeriesCombineMode.Stack; barSeries3.DataPoints.Add(new CategoricalDataPoint(153, "Harley")); barSeries3.DataPoints.Add(new CategoricalDataPoint(141, "White")); barSeries3.DataPoints.Add(new CategoricalDataPoint(130, "Smith")); barSeries3.DataPoints.Add(new CategoricalDataPoint(88, "Jones")); barSeries3.DataPoints.Add(new CategoricalDataPoint(109, "Marshall")); this.radChartView1.Series.Add(barSeries3); this.radChartView1.ShowTrackBall = true; Note: the trackball labels should be displayed in the order the series are displayed in the chart view. Workaround: private void ChartTrackballController_TextNeeded(object sender, TextNeededEventArgs e) { string pattern = " \\d+.?\\d* "; StringBuilder sb = new StringBuilder("<html>"); List<DataPointInfo> points = new List<DataPointInfo>(); foreach (DataPointInfo dp in e.Points) { points.Add(dp); } points.Reverse(); foreach (DataPointInfo dp in points) { Color pointColor = this.GetColorForDataPoint(dp.Series, dp.DataPoint); string color = string.Format("{0},{1},{2},{3}", pointColor.A, pointColor.R, pointColor.G, pointColor.B); sb.AppendFormat("<color={0}>{1}", color, string.Format("{0} {1}", dp.Series.Name, ((CategoricalDataPoint)dp.DataPoint).Value)); sb.AppendLine(); } e.Text = sb.ToString(); } protected virtual Color GetColorForDataPoint(ChartSeries series, DataPoint point) { if (series is IndicatorBase) { return series.BorderColor; } foreach (UIChartElement element in series.Children) { DataPointElement pointElement = element as DataPointElement; if (pointElement != null) { if (pointElement.DataPoint.Equals(point)) { if (pointElement.BackColor.A > 0) { return pointElement.BackColor; } else { return pointElement.BorderColor; } } } } return Color.Black; }