This code produces a blank image. Am I missing something?
var radChartView1 = new RadChartView();
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") { Label = "My Label" });
series.ShowLabels = true;
series.DrawLinesToLabels = true;
series.SyncLinesToLabelsColor = true;
radChartView1.ShowSmartLabels = true;
radChartView1.Series.Add(series);
flowLayoutPanel1.Controls.Add(radChartView1);
radChartView1.ChartElement.UpdateLayout();
var name5 = Path.Combine(_outputBasePath, "data05.png");
ThemeResolutionService.AllowAnimations = false;
radChartView1.ExportToImage(name5, radChartView1.Size, ImageFormat.Png);
Hi,
Is it possible to have multiple grids in your chart when working with multiple axes? I only get the grid for the last axis, which is the yellow one in the image below. I would like to have a grid for each axis.
Hello team,
As said in the title, I have a Chart with a cartesian grid visible and working fine. The problem is when I add a series programmatically and the series data is empty (see img.2): my chart displays the new axis as expected with no values since there is no data for the series, but the grid disappears.
Img.1 : Two series with data. The grid is visible fine.
Img.2: Two series with one empty. The grid disappears.
Is there a way to add Tool Tip Text to the legend items that get generated? I have Tool Tip Text on the Series object, but I would like it on the Legend Items as well.
Also, one other question, is there a way to customize how the legend shows the value next to the key? Right now, our legand keys are "ABC 123". I would like to add a "-" between the KEY and the COUNT value.
TIA
Hi team ,
I am using Telerik UI for winforms Chartview Drill down charts. I am using line series . I need to get the labels on top of every value( please refer attached screenshot of demo app) but getting object reference not set to an instance of an object .particularly in line series.ShowLabels = true; Can you please guide on this?
If I set
series.DataSource = DrillDownViewModel.ParseDataByDay(year, month);
Thanks
Anup
Hi team,
I have a scenario where we need to add line series to the chart dynamically from code behind and I need to bind live data (i.e, data changes for every 2 seconds) . I am using Telerik UI for WinForms controls .
One static line series work perfectly fine using the demo sample. The problem is adding 'n' number of line series and setting data every 2 seconds . In the sample , data is set using a global variable. but we need to achieve the same dynamically
Can anyone guide on this
Hi!
I have a chart with multiple Y axes, series, and an X axis as DateTimeContinuousAxis.
The thing is my chart is customizable and I should be able to change the series styling from line to column. When I change one of my series to a column, it is not centered with the rest of the series and according to the X-axis (see first img).
See the tooltips that the lines are at the same point (img2) but when I change to column, the column ends at that point, it is not centered.
Any suggestion?
Columns
Linear
Hi
I am playing with the RadRangeSelector. I have associated it to an existing chart. The chart is dynamically filled using data from the database.
In the image here below, the top control is a RadRangeSelector, the bottom control is a RadChartView.
Notice that my bottom chart shows series as stacked. How can I get the RadRangeSelector also showing stacked series?
Also notice that the dates are not inlined between top and bottom. How can the RadRangeSelector be sorted by dates (as my chart is showing)?
Hi,
I'm using Telerik for Winforms 2023.3.1010 on .NET 7.
While trying to configure the position of my label position using PieTwoLabelColumnsStrategy, only the first label seems to be working with DistanceBetweenLabels property.
PieTwoLabelColumnsStrategy strategy = new PieTwoLabelColumnsStrategy()
{
DistanceBetweenLabels = 50,
DistanceToLabel = -100
};
SmartLabelsController smartLabelsController = new SmartLabelsController
{
Strategy = strategy
};
radChartView.Controllers.Add(smartLabelsController);
radChartView.ShowSmartLabels = true;
Here is how I'm filling the chart:
radChartView.AreaType = ChartAreaType.Pie;
radChartView.Series.Clear();
DonutSeries donut = new DonutSeries
{
ShowLabels = true,
LabelMode = PieLabelModes.Horizontal,
DrawLinesToLabels = true,
SyncLinesToLabelsColor = true,
NumberOfColors = categoryCount
};
foreach (var v in totals.OrderByDescending(s => s.Statut))
{
PieDataPoint point = new PieDataPoint(v.Nombre, v.Statut)
{
Label = $"{v.Percentage}% {v.Statut}"
};
donut.DataPoints.Add(point);
}
radChartView.Series.Add(donut);
radChartView.Area.View.Palette = KnownPalette.Metro;
radChartView.SelectionMode = ChartSelectionMode.SingleDataPoint;
radChartView.BackColor = Color.WhiteSmoke;
With small percentages, it doesn't work (except of the right bottom label)
With higher percentages it seems to be working :
The behavior is quite inconsistent.
Thank you for your help.
Hello Telerik Team,
I want to implement some custom renderings or a overlay for a radChart. I added a screenshot of my application with some annotations. My goal is to remove the dummy resource from the scheduler. The cells of the dummy resource are only used to show workload-percentages. But before I can remove it, I need to display the workload in the ChartView, more precisely in the RangeSelector.
I already implemented a custom CartesianRenderer and custom BarSeriesDrawPart to control the color of the bars depending on the calculated workload. But now I want a Label with the workload percentage centered on each bar. But i don't know how to calculate the the rectange of the area from 0% to 100% to figure out the correct positioning.
My solution so far:
internal class CustomBarSeriesDrawPart : BarSeriesDrawPart
{
public Font DefaultFont { get; private set; }
public CustomBarSeriesDrawPart(BarSeries series, IChartRenderer renderer, Font defaultFont) : base(series, renderer)
{
DefaultFont = defaultFont;
}
public override void DrawSeriesParts()
{
//LogHelper.Info("CustomBarSeriesDrawPart.DrawSeriesParts() START");
if (!(Renderer is CustomCartesianRenderer renderer))
throw new ApplicationException($"Renderer ist nicht vom Typ \"{nameof(CustomCartesianRenderer)}\"");
var graphics = ((ChartRenderer)Renderer).Graphics;
var radGraphics = new RadGdiGraphics(graphics);
for (int i = 0; i < Element.DataPoints.Count; i++)
{
RadRect slot = Element.DataPoints[i].LayoutSlot;
//how to get the rectangle for the full slot (from 0% to 100% height)?
RectangleF barBounds = new RectangleF((float)(OffsetX + slot.X), (float)(OffsetY + slot.Y), (float)slot.Width, (float)slot.Height);
DataPointElement childElement = (DataPointElement)Element.Children[i];
float realWidth = barBounds.Width * childElement.HeightAspectRatio;
barBounds.Width = realWidth;
barBounds.Height = Math.Max(barBounds.Height, 1f);
double percentage = 0;
Color color;
if (Element.DataPoints[i] is CategoricalDataPoint point)
{
percentage = point.Value ?? 0;
//color = Owner.Auslastungsfarbe(percentage);
color = renderer.Owner.Auslastungsfarbe(percentage);
}
else
color = Color.LightGray;
radGraphics.FillRectangle(barBounds, color);
//radGraphics.DrawEllipse();
var parameters = new TextParams()
{
text = $"{(int)percentage}%",
alignment = ContentAlignment.MiddleCenter,
foreColor = Color.Black,
paintingRectangle = barBounds,
font = DefaultFont,
};
radGraphics.DrawString(parameters, barBounds.Size);
}
//base.DrawSeriesParts();
}
}
Hope you can help my with it.
Regards,
Stephan