This is a migrated thread and some comments may be shown as answers.

XAxis Label inside the bar

1 Answer 68 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tobin
Top achievements
Rank 1
Tobin asked on 15 Oct 2008, 12:17 PM
Hi Telerik.

1. How do i put XAxis label (O in styling chart element) inside the bar (P in styling chart element) instead in bottom ? I have difficulty since my XAxis data is long.

2. How do i format Series Item Label (r in styling chart element) to number with decimal?

3. My bar chart bound to empty dataset, how to make sure that the chart will show EmptyChartMessage, since my case it didnt show.


Thank for your help.

1 Answer, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 17 Oct 2008, 07:04 AM
Hello Tobin,

It is not possible to move the Axis Labels inside a bar nor any other chart as those labels are designed to display information on the Axes. If you prefer, you can hide them by setting

this.radChart1.PlotArea.XAxis.Appearance.LabelAppearance.Visible = false;

You can customize the items' labels by handling the Chart's ItemDataBound event:
public partial class Form1 : Form 
    double[] sampleData = new double[] { 0, 10, 20, 30, 40, 5, 20, 35, 50, 65 }; 
 
    public Form1() 
    { 
        InitializeComponent(); 
 
        this.radChart1.PlotArea.XAxis.Appearance.LabelAppearance.Visible = false
        this.radChart1.ItemDataBound += new EventHandler<ChartItemDataBoundEventArgs>(radChart1_ItemDataBound); 
 
        this.radChart1.DataSource = sampleData; 
        this.radChart1.DataBind(); 
    } 
 
    void radChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e) 
    { 
        e.SeriesItem.Label.TextBlock.Text = "New Label"
        e.SeriesItem.Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside; 
    } 

The EmptyChartMessage shows up only in case there are no series in the RadChart.Series collection (and none are generated by the binding). Having no ChartSeriesItems in the series does not count as empty chart.

Regards,
Evtim
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Chart (obsolete as of Q1 2013)
Asked by
Tobin
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Share this question
or