Custom DataSource in Y-Axis

4 posts, 0 answers
  1. Fahad
    Fahad avatar
    17 posts
    Member since:
    May 2011

    Posted 15 Jun 2011 Link to this post

    Hi, I would like to bind my own data-source in Y-axis, I have a negative axis chart whose X and Y axis should have custom data that the Chart should show up. I can see that X-Axis has a XCategory property to define a category, But something like that is not available in Y-axis. Can you please let me know how this is possible, any workaround is also fine!

    Further note: After looking at your source code I think your chart is not supporting this. I also tried to customize by creating a custom template for AxisLabel2D, but this is very generic code, the templated code applies for both x & y axis :). My scenario is that I will exactly know the number of y points and its related string value, so I can write a converter and return my own text based on the TickPoint.CurrentIndex. One major problem here in the converter is, I'm not able to find if it is AxisX or AxisY, this value is stored in ILogicalItem but that interface is marked internal :(. 

    I would appreciate any good help on this.

    -Fahad
  2. Fahad
    Fahad avatar
    17 posts
    Member since:
    May 2011

    Posted 16 Jun 2011 Link to this post

    I figured out that the negative axis is actually changing the X-Axis to the left side, so that made things a bit simpler I could now just use XCategory to bind my categorical values. 

    One last query is that I want my Y-axis which shows in the bottom to be on the top, I just need to change the position and nothing else, Please find the sample from -> http://dl.dropbox.com/u/23500975/Telerik/NegativeChartSample.zip

    Any pointers to change the Y-axis location would be great!

    Thanks,
    Fahad
  3. Missing user
    Missing user avatar

    Posted 20 Jun 2011 Link to this post

    Hello Fahad,

    You can change the position of the YAxis by re-templating the ChartArea. By default the structure of our ChartArea is a grid with three columns and three rows:

       Additional X Axes  
     Y Axis  
     PlotArea  Additional Y Axes
       X Axis  
         
    In the attached file you can find an example how to change the position of the YAxis, based on the project provided.

    Another approach is to add additional YAxis to the ChartArea.AdditionalYAxes collection. For example:
    <telerik:RadChart x:Name="radChart1" >
        <telerik:RadChart.DefaultView>
            <telerik:ChartDefaultView>
                <telerik:ChartDefaultView.ChartArea>
                    <telerik:ChartArea>
                        <telerik:ChartArea.AdditionalYAxes>
                            <telerik:AxisY AxisName="topAxisY"
                                           AutoRange="False"
                                           MinValue="-55"
                                           MaxValue="55"
                                           Step="5"
                                           DefaultLabelFormat="#;#"/>
                        </telerik:ChartArea.AdditionalYAxes>
                    </telerik:ChartArea>
                </telerik:ChartDefaultView.ChartArea>
            </telerik:ChartDefaultView>
        </telerik:RadChart.DefaultView>
        ...
    </telerik:RadChart>

    Have a look at the following online resources for an overview of the Multiple Y axes:
    http://www.telerik.com/help/silverlight/radchart-features-axes-multiple-y-axes.html
    http://demos.telerik.com/silverlight/#Chart/MultipleYAxes

    I hope this helps.

    Best wishes,
    Polina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Fahad
    Fahad avatar
    17 posts
    Member since:
    May 2011

    Posted 20 Jun 2011 Link to this post

    Thanks, this works fine!

    On a side note, It would have been better if Chart styles where enabled for templating using Blend like you have for the other controls! :)
Back to Top