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

Alternating XAxis Item Label Display

5 Answers 75 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Anette
Top achievements
Rank 1
Anette asked on 23 Sep 2008, 12:27 AM
Hi,

Is there a way to display XAxis Item Label in way similar to this?
http://www.dundas.com/Gallery/Chart/NET/index.aspx?Img=glazed

Thank you.

5 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 23 Sep 2008, 02:41 PM
Hello Anette,

Unfortunately RadChart does not provide support for such stepped label display and it would not be possible to achieve the desired functionality.


All the best,
Manuel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Anette
Top achievements
Rank 1
answered on 25 Sep 2008, 10:57 PM
Hello Manuel

Thank you for confirming this matter.
0
Anette
Top achievements
Rank 1
answered on 28 Sep 2008, 10:06 PM
Hello Manuel,

Since stepped label display cannot be implemented in Telerik, I used the Automatic Text-wrapping feature.

We are using dates in the x-axis. Is there a way to display it this way? Wherein the year is always on the second line so that we can have uniformity.
  Jul       Aug        Sept
2008    2008       2008

Thank you.
0
Accepted
Giuseppe
Telerik team
answered on 29 Sep 2008, 08:38 AM
Hi Anette,

The AutoTextWrap algorithm cannot be customized in such a way but you can achieve the desired functionality by manually adding a newline in the axis item label display (and disabling the AutoTextWrap as well). Here is a sample code snippet to get you started:

ASPX:
<telerik:RadChart ID="RadChart1" runat="server" AutoLayout="true" Width="278px"  
    OnBeforeLayout="RadChart1_BeforeLayout"
    <Series> 
        <telerik:ChartSeries Name="Series 1"
            <Items> 
                <telerik:ChartSeriesItem Name="Item 2" YValue="6"
                </telerik:ChartSeriesItem> 
                <telerik:ChartSeriesItem Name="Item 3" YValue="3"
                </telerik:ChartSeriesItem> 
                <telerik:ChartSeriesItem Name="Item 4" YValue="1"
                </telerik:ChartSeriesItem> 
            </Items> 
        </telerik:ChartSeries> 
    </Series> 
    <PlotArea> 
        <XAxis AutoScale="False" MinValue="1" MaxValue="3" Step="1"
            <Items> 
                <telerik:ChartAxisItem Value="1"
                    <TextBlock Text="Jul 2008"
                    </TextBlock> 
                </telerik:ChartAxisItem> 
                <telerik:ChartAxisItem Value="2"
                    <TextBlock Text="Aug 2008"
                    </TextBlock> 
                </telerik:ChartAxisItem> 
                <telerik:ChartAxisItem Value="3"
                    <TextBlock Text="Sept 2008"
                    </TextBlock> 
                </telerik:ChartAxisItem> 
            </Items> 
        </XAxis> 
    </PlotArea> 
</telerik:RadChart> 

Code-behind:
protected void RadChart1_BeforeLayout(object sender, EventArgs e) 
    foreach (ChartAxisItem axisItem in RadChart1.PlotArea.XAxis.Items) 
    { 
        axisItem.TextBlock.Text = Regex.Replace(axisItem.TextBlock.Text, " ", "\n"); 
    } 


Hope this helps.


Best wishes,
Manuel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Anette
Top achievements
Rank 1
answered on 29 Sep 2008, 09:50 PM
Hello Manuel,

Thank you for your help.

Cheers,
Anette
Tags
Chart (Obsolete)
Asked by
Anette
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Anette
Top achievements
Rank 1
Share this question
or