So i have this model:
public class MachineNetworkAdapter
{
public string Name { get; set; }
public string IpAddress { get; set; }
public static List<
MachineNetworkAdapter
> MachineAdapters;
}
So each mechine adapter have this members.
So i have this Combobox that show all my Machine Adapters:
<
ComboBox
Name
=
"cbAdapterss"
ItemsSource
=
"{Binding MachineAdapters}"
SelectionChanged
=
"cbInterfaces_SelectionChanged"
/>
So in this case i can see all my machine adapters with this properties.
Now i want to see also my adapters Rate in MBit/sec so i added this members:
public Series { get; set; }
public double Rate { get; set; }
the member Rate is MBit/sec and the value is changing every 1 sec. the series is for the chart in order to put into the values.
So i added template with chartand now this is my Combobox:
<
ComboBox
Name
=
"cbAdapters"
ItemsSource
=
"{Binding MachineAdapters}"
SelectionChanged
=
"cbInterfaces_SelectionChanged"
>
<
ComboBox.ItemTemplate
>
<
DataTemplate
>
<
telerik:RadCartesianChart
x:Name
=
"chartTemplate"
/>
</
DataTemplate
>
</
ComboBox.ItemTemplate
>
</
ComboBox
>
So now all i can see in my Combobox is an empty chart without the other properties. So my question is how can i populate my chart and also see the other properties (Name, IPAddress).
7 Answers, 1 is accepted
Thank you for your interest in RadChartView.
The chart is not populated because you haven't specified the axis which you are going to use and the series. You can take a look at the following resources which could help you to implement your approach.
- Getting Started help article of the RadChartView
- Series: Help section which describes the series which you can use to visualize your data
- Create Data-Bound Chart: Help article which describes how you can bind you chart
- Features: Help section which describes different functionalities of the control
- GitHub repository and WPF Controls Demo where you can find different sample projects
Hope this information is helpful. Please, let us know if further questions arise.
In addition, you set the Product tag of this thread to our old RadChart component. From the attached code snippet we can see that you are using the new chart (RadChartView) so we are changing the Product tag of this thread to RadChartView for WPF.
Dinko
Telerik by Progress
I prepared a small example that demonstrates how you can use the chart in the described scenario. Please give it a try and let me know if it helps. I would also recommend you to check the resource provided by Dinko. You can check Getting Started that demonstrates how to set up the chart.
About creating the series in code behind, you can do that. However, in your case this won't be very straight forward because you have the chart defined in a DataTemplate. This means that you cannot access it via code behind. In this case you could think of another approach setting the chart's properties in code. Or just define it in XAML.
Regards,
Martin
Telerik by Progress
You can open the WpfApplication1.csproj file with Visual Studio.
Regards,
Martin
Telerik by Progress
This is because the chart doesn't support showing any additional information except the plotted data. To show the Name and IpAddress and your side you will need to think on how you want to visualize them and then implement this with custom code.
A possible approach for you could be use a legend, this will allow you to take advantage of the chart's RadLegend support.
Regards,
Martin Ivanov
Progress Telerik