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

Change axis plot values after databind?

3 Answers 91 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.
joseph_korn
Top achievements
Rank 1
joseph_korn asked on 21 May 2008, 11:05 PM
For example, if I am binding my chart to a dataset I could write some code like this:

Me.RadChart1.DataManager.DataSource = myDataSet 
Me.RadChart1.DataManager.ValuesXColumn = "SomeValue" 

Is it possible, after a databind, to get access to those plot values of "SomeValue" so that they can be updated later on? I realize that I could change the dataset value and rebind if needed, but I am wondering if it is possible to get access to the values in the chart once they are bound.

3 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 22 May 2008, 11:20 AM
Hi Joseph,

Thank you for writing.

You can manipulate the data after the data binding by simply accessing the items in the required series:

Me.RadChart1.DataManager.DataSource = myDataSet  
Me.RadChart1.DataManager.ValuesXColumn = "SomeValue" 
Me.RadChart1.DataManager.DataBind() 
Me.radChart1.Series(0).Items(0).YValue = 15 

Should you have further questions, do not hesitate to write us back.

Sincerely yours,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
joseph_korn
Top achievements
Rank 1
answered on 27 May 2008, 03:26 PM
Thanks for the reply, but now after reading my original post, I realize that I was not using the correct terms.. The data I am looking to change is not the plot values, but the plot labels..

I wish to change the labels of the x or y axis after databind if it is possible.. Is there any way?
0
Accepted
Dwight
Telerik team
answered on 29 May 2008, 06:15 AM
Hi Joseph,

It is possible to change the labels on both axes. What you should do is handle the BeforeLayout event. At this point the labels are already created, and you can change their values to the required ones. Here is an example:

Public Sub New() 
    InitializeComponent() 
 
    AddHandler Me.radChart1.BeforeLayout, AddressOf radChart1_BeforeLayout 
End Sub 
 
Private Sub radChart1_BeforeLayout(ByVal sender As ObjectByVal e As EventArgs) 
    Dim i As Integer = 0 
    While i < Me.radChart1.PlotArea.YAxis.Items.Count 
        Me.radChart1.PlotArea.YAxis.Items(i).Appearance.RotationAngle = 20 
        Me.radChart1.PlotArea.YAxis.Items(i).TextBlock.Text = String.Format("new label {0}", i) 
        i = i + 1 
    End While 
End Sub 

I hope this example will help.
If you have further questions, drop us a line. We will be glad to help.

Regards,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Chart (obsolete as of Q1 2013)
Asked by
joseph_korn
Top achievements
Rank 1
Answers by
Dwight
Telerik team
joseph_korn
Top achievements
Rank 1
Share this question
or