the same margin is applied to all xaxis labels. I would like this margin to be different for different chart axis items. How to achieve this functionality?
5 Answers, 1 is accepted
Unfortunately this customization is not possible at the moment -- we will forward your feedback to our developers so they can consider it for one of the future versions of the control.
the Telerik team
I have a similar issue. I would like to change the Aligned Position of my labels on the chart to the bottom of the graph. I don't know whether the length of the labels is an issue since I am using times as the default label text. But no matter what I try I am unable to move the labels. I have tried to change both the series and the series item properties for Aligned Position, and also for position.x and position.y, and also for offset y and offset x. Below are the functions I am using to set the series and series item properties. I have also turned off Auto for the positions.
Here is the code behind in C#
protected void SetSeriesAppearance(ChartSeries series)
new Font("Tahoma", 8);
//series.Appearance.ShowLabelConnectors = true;
//appear to do nothing
series.Appearance.CenterXOffset = 100;
series.Appearance.CenterYOffset = 100;
protected void SetSeriesItemProperties(ChartSeriesItem seriesitem, int intTypeCode)
//seriesitem.Appearance.Border.Color = Color.Black;
//seriesitem.Label.Appearance.Border.Color = Color.Black;
seriesitem.Label.Appearance.Dimensions.Paddings.Top = 2;
seriesitem.Label.Appearance.Dimensions.Paddings.Left = 0;
//appear to do nothing to labels.
//seriesitem.Label.Appearance.Dimensions.Margins.Top = 115;
//seriesitem.Label.Appearance.Dimensions.Margins.Left = 55;
seriesitem.Label.Appearance.Distance = 240;
//seriesitem.Appearance.TextAppearance.TextProperties.Font = new Font("Tahoma", 8);
//seriesitem.Appearance.TextAppearance.TextProperties.Color = Color.Black;
//seriesitem.Appearance.LabelAppearance.Dimensions.Margins = new ChartMargins(5);
seriesitem.Label.Appearance.Distance = 0;
//seriesitem.Label.Appearance.Position.Auto = true;
//seriesitem.Appearance.FillStyle.FillSettings.ComplexGradient = true;
seriesitem.Label.Appearance.LabelConnectorStyle.PenStyle = System.Drawing.Drawing2D.
seriesitem.Label.Appearance.LabelConnectorStyle.Color = System.Drawing.
//Absolute positioning of Labels DZ
seriesitem.Label.Appearance.Position.X = 245;
seriesitem.Label.Appearance.Position.Y = 45;
seriesitem.Label.Appearance.RotationAngle = 45;
// seriesitem.Label.Appearance.LabelLocation = StyleSeriesItemLabel.ItemLabelLocation.Auto;
Please let me know what properties are needed to achieve this and if the labels can be positioned below the bottom of the bar graph. I am using Y axis only at this point.
You can change the alignment of the series item labels like this:
However, it is not possible for the series item labels to be placed under the bars. You can use the axis item labels if you would like to achieve the original appearance.
Hope this helps.
the Telerik team
I see that there is a ChartAxisItem class. If I create ChartAxisItems as in the following..
axisItem0 = new ChartAxisItem();
Is this the correct approach, and if so do these have to be added to the Series the way the SeriesItems are? I would like to add Axis item labels that are independent of the value but reflect the time string that I am adding from the data table.
If you would like to customize the axis item labels manually, you need to set the AutoScale property of the axis to "false" and customize its MinValue / MaxValue / Step properties like this:
All the best,
the Telerik team