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

Custom DataSource in Y-Axis

3 Answers 63 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Fahad
Top achievements
Rank 1
Fahad asked on 15 Jun 2011, 01:21 PM
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

3 Answers, 1 is accepted

Sort by
0
Fahad
Top achievements
Rank 1
answered on 16 Jun 2011, 08:07 AM
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
0
Missing User
answered on 20 Jun 2011, 02:09 PM
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
0
Fahad
Top achievements
Rank 1
answered on 20 Jun 2011, 02:41 PM
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! :)
Tags
Chart
Asked by
Fahad
Top achievements
Rank 1
Answers by
Fahad
Top achievements
Rank 1
Missing User
Share this question
or