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

Dynamic and multiple LineSeries creation (xaml)

1 Answer 76 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
FARE
Top achievements
Rank 1
FARE asked on 27 Sep 2012, 03:15 PM
Hello all !

(I warn you immediately, my native language is French, so sorry for any mistake)

I started develop a WindowsPhone application which use Telerik chart controls. I see how easy it is to create graphs (in xaml) but it's  limited in a case where I don't know the number of series to construct.

For example :

I have two entities :

public class Indicateur
{
public virtual long IdProjet {get;set;}
public virtual Guid? IdIndicateur {get;set;}
public virtual string Nom {get;set;}
public virtual string TypeUnite {get;set;}
public virtual long? Limite1 {get;set;}
public virtual long? Limite2 {get;set;}
public virtual DateTime DateCreation {get;set;}
public virtual IList<Information> Valeurs {get;set;}
}
public class Information
{
public virtual long? IdInformation {get;set;}
public virtual Guid IdIndicateur {get;set;}
public virtual decimal Valeur {get;set;}
public virtual DateTime DateCreation {get;set;}
}
(I don't show it but there is PropertyChanged notification system)

In my viewmodel, I do db request that returns a List of "Indicateur".

Here is my problem :

There is a complex tree :

An "Indicateur" has a list of "Information". Each Information has a "Valeur" (value).
Is there a way to dynamically build the LineSeries points?

Infact, I am quite familiar with this kind of data manipulation:
<ListBox ItemsSource="{Binding Indicateurs, Source={StaticResource vueModeleIndicateur}}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <ListBox ItemsSource="{Binding Valeurs}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Valeur}"/>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

Thank you in advance for your help!

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 28 Sep 2012, 07:32 AM
Hello Fare,

Thank you for the question.
Currently you can progammatically manipulate the series and their points. On your RadChart object, you have a Series property. This is a collection of all series in the chart. Then each series object in this collection has a DataPoints property data you can manipulate manually. Also each series has an ItemsSource property that you can use for data binding instead of manually populating the DataPoints collection.

I hope this is helpful.

Kind regards,
Victor
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Tags
Chart
Asked by
FARE
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or