Y-Axis ItemLabel as Text

5 posts, 2 answers
  1. Woramin
    Woramin avatar
    25 posts
    Member since:
    Aug 2011

    Posted 14 Nov 2011 Link to this post

    Hi there,

    I would like chartArea's Y-Axis in the RadChart not to have the label as the number but as the text just like the image below
    http://upic.me/i/f1/chartonoff.png


    The details are
    - Have Y-Axis ItemLabel as only "On" and "Off"
    - X-Axis ItemLabel still be the collection of text from the XCategory
    - Have no any point shown in the chart area

    Is it possible to do something like this at this moment

    Thanks
  2. Answer
    Nikolay
    Admin
    Nikolay avatar
    397 posts

    Posted 17 Nov 2011 Link to this post

    Hello Woramin,

    Please, find attached a sample application, which demonstrates how to achieve the desired behavior.

    Hope this helps. 

    Kind regards,
    Nikolay
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Woramin
    Woramin avatar
    25 posts
    Member since:
    Aug 2011

    Posted 18 Nov 2011 Link to this post

    Hi Nikolay,

    I found the problem to my customized solution about your code

    The Problem is about this event

    private void RadChart_DataBound(object sender, ChartDataBoundEventArgs e)
    {
        RadChart chart = sender as RadChart;
     
        foreach (TickPoint tick in chart.DefaultView.ChartArea.AxisY.TickPoints)
        {
            tick.Label = MyClass.Processes[(int)tick.Value];
        }
    }



    According to my code, I turn off defaultViewLayout and then create own multiple chart Area with same step as this link in the code behind C#

    http://www.telerik.com/help/silverlight/radchart-populating-with-data-data-binding-to-many-chart-areas.html


    Then,  since I add chartArea into Grid (And grid become radChart.Content), Instead of call chartArea from the DefaultView, How can I call chartArea(s) from the Grid in the event DataBound (Suppose I have 3 chartArea in it)
  4. Answer
    Nikolay
    Admin
    Nikolay avatar
    397 posts

    Posted 23 Nov 2011 Link to this post

    Hello Woramin,

    In this case the best alternative would be to subscribe to the specific chart area's AxisY.RangeChanged event :
    ChartArea chartArea3 = new ChartArea();
    chartArea3.Name = "Area3_Name";
    chartArea3.AxisY.RangeChanged +=new EventHandler(AxisY_RangeChanged);

     instead of doing it on the DataBound event of the RadChart.

    All the best,
    Nikolay
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  5. Woramin
    Woramin avatar
    25 posts
    Member since:
    Aug 2011

    Posted 24 Nov 2011 Link to this post

    Thanks Nikolay,

    The code works fine now.
Back to Top