Hi Juliano,
Thanks for using Syncfusion products.
We can achieve your requirement by setting SfChart as content of ContentControl and creating chart in view model. Using this solution you can able to add axis, series, header to chart dynamically. Please refer the below code snippet.
Code snippet [XAML]:
|
<Grid >
<Grid.DataContext>
<local:ViewModel/>
</Grid.DataContext>
<ContentControl Content="{Binding Chart}"/>
</Grid>
|
Code snippet [C#]:
|
public SfChart Chart { get; set; }
public ViewModel()
{
GenerateData();
Chart = new SfChart();
Chart.PrimaryAxis = new NumericalAxis();
Chart.SecondaryAxis = new NumericalAxis();
SplineAreaSeries series = new SplineAreaSeries();
series.XBindingPath = "XValue";
series.YBindingPath = "YValue";
series.ItemsSource = Data;
Chart.Series.Add(series);
}
|
We have prepared a sample based on this, please find the sample from the following location.
Please let us know if you have any queries.
Thanks,
Muneesh Kumar G.