We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Looking for a good example to change and add dynamicly axis.

Hi Syncfusion Support!

We' re still evaluating your WPF Controls, specifically the sfchart. We' re a great fan of your examples to leverage our learnings. 

Do you have an example to change and add dynamically axis and bindings in C#?

Thank you very much!

regards, 
Sascha

1 Reply

MK Muneesh Kumar G Syncfusion Team May 23, 2019 10:06 AM UTC

Hi Sascha, 
 
Greetings from Syncfusion.  
 
We have analyzed your requirement and we have prepared a sample based on that. We have updated the axis with already defined axis in resource as per the below code snippet.  
 
Code snippet 
  <Grid.Resources> 
            <chart:NumericalAxis x:Key="numerical"/> 
 
            <chart:CategoryAxis x:Key="category"/> 
 
            <chart:LogarithmicAxis x:Key="log"/> 
             
             
        </Grid.Resources> 
 
 
private void Button_Click(object sender, RoutedEventArgs e) 
        { 
            if(chart.SecondaryAxis is LogarithmicAxis) 
            chart.SecondaryAxis = grid.Resources["numerical"] as RangeAxisBase; 
            else 
                chart.SecondaryAxis = grid.Resources["log"] as RangeAxisBase; 
        } 
 
You can axis with series as per the below code snippet.  
 
Code snippet 
private void Button_Click_1(object sender, RoutedEventArgs e) 
        { 
            FastColumnBitmapSeries series = new FastColumnBitmapSeries(); 
            series.XBindingPath = "XValue"; 
            series.YBindingPath = "YValue"; 
            series.ItemsSource = viewModel.Data; 
            series.YAxis = new NumericalAxis(); 
 
            chart.Series.Add(series); 
        } 
 
 
Please refer below user documentation for more details about axis types and customization.  
 
 
Please let us know if you have any queries.  
 
Regards, 
Muneesh Kumar G. 


Loader.
Live Chat Icon For mobile
Up arrow icon