Create a chart with multiple lines entirely through code

2 posts, 1 answers
  1. Ramya
    Ramya avatar
    27 posts
    Member since:
    Jan 2011

    Posted 08 Oct 2012 Link to this post

    I wanted to create a chart with multiple lines as shown in the attached image entirely in code as i want to create it dynamically. How do i do it. Would appreciate a working sample.

  2. Answer
    Petar Marchev
    Petar Marchev avatar
    1029 posts

    Posted 11 Oct 2012 Link to this post

    Hello Ramya,

    Do you have any specific question on how to do this? In general the RadCartesianChart can be defined either through XAML or C# (or both). So, yes, you can set up your chart in C# completely. I have attached a very simple app to demonstrate this. The C# code in the ctor is the equivalent of the commented XAML.

    Note that I have used both PropertyNameDataPointBinding and GenericDataPointBinding. This is only to demonstrate the alternatives. The XAML parser creates PropertyNameDataPointBinding, but I think in code behind it is much more convenient to use the GenericDataPointBinding.

    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top