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.
Unfortunately, activation email could not send to your email. Please try again.

Chart Empty and 1 question

Thread ID:

Created:

Updated:

Platform:

Replies:

124161 May 22,2016 06:03 AM Jun 12,2016 11:44 PM UWP 7
loading
Tags: SfChart
PINEAU
Asked On May 22, 2016 06:03 AM

Hello
I have 2 problems with my application and SFCHART and 1 question.

1) When I open my application and click the "buttonFacture" in MainPage.xaml,  columns are empty in MainFacturePage.xaml

XAML

 <syncfusion:ColumnSeries ItemsSource="{Binding Facture}"
                                     XBindingPath="Annee"
                                     YBindingPath="Montant"
                                     Label="Factures en €">
              
                <syncfusion:ColumnSeries.AdornmentsInfo>
                    <syncfusion:ChartAdornmentInfo ShowConnectorLine="True"
                                                   ConnectorHeight="10"
                                                   ConnectorRotationAngle="90"
                                                   ShowLabel="True"
                                                   LabelRotationAngle="45"
                                                   LabelPosition="Outer"/>               
                </syncfusion:ColumnSeries.AdornmentsInfo>
            </syncfusion:ColumnSeries>

CS

public MainFacturePage()
        {
            this.InitializeComponent();
        }

        public class FacturesAnnuelle
        {
            public string Annee { get; set; }
            public double Montant { get; set; }
        }

        public static ObservableCollection<FacturesAnnuelle> Facture { get; set; }

        public class ViewModel
        {
            public ViewModel()
            {
                Facture = new ObservableCollection<FacturesAnnuelle>();
                Facture.Add(new FacturesAnnuelle() { Annee = "2010", Montant = 100.24 });
                Facture.Add(new FacturesAnnuelle() { Annee = "2011", Montant = 100.09 });
                Facture.Add(new FacturesAnnuelle() { Annee = "2012", Montant = 100.92 });
                Facture.Add(new FacturesAnnuelle() { Annee = "2013", Montant = 100.48 });
                Facture.Add(new FacturesAnnuelle() { Annee = "2014", Montant = 100.07 });
                Facture.Add(new FacturesAnnuelle() { Annee = "2015", Montant = 100.88 });
                Facture.Add(new FacturesAnnuelle() { Annee = "2016", Montant = 0 });
                Facture.Add(new FacturesAnnuelle() { Annee = "2017", Montant = 0 });
                Facture.Add(new FacturesAnnuelle() { Annee = "2018", Montant = 0 });
                Facture.Add(new FacturesAnnuelle() { Annee = "2019", Montant = 0 });
                Facture.Add(new FacturesAnnuelle() { Annee = "2020", Montant = 0 });
            }
        }


2) If I do not put  "public ObservableCollection<FacturesAnnuelle> Facture { get; set; }"  in static, i have this issue  :  An object reference is required for , method, or property or the non-static field "MainFacturePage.Facture"

3) Is it possible to recover the data from a textbox to put in YBindingPath ?

Thanks for your help

Richard

Attachment: DavComptElec_a949f5d3.rar

Rachel A [Syncfusion]
Replied On May 23, 2016 08:30 AM

Hi Pineau, 

Thanks for contacting Syncfusion Support. 

Query1: Problem in displaying columns  

We have to set the data context for the control to provide source reference for the property binding in column series ItemsSource property. 

Query2: Regarding the object reference error  

We can resolve this error by defining the observable collection property inside the View Model class and also removed the static keyword.  

Query3: Is it possible to recover the data from a textbox to put in YBindingPath ? 

We have stored first column segment y-data in the textbox, if we edited the data in the textbox means it will be reflected in the column segment.  

We have prepared a sample for all your queries. Please find the sample from the below location. 
 
 
Please let us know, this solution satisfies your requirement. If not please provide more information about your requirements. 
 
Regards, 
Rachel. A 



PINEAU
Replied On May 25, 2016 01:56 AM

Hello

thank you for your reply

When I test your example it works very well but if I apply this in my application the columns are still empty..

This certainly comes again that I have an error in my xaml page : "The name "ViewModel" does not exist in the namespace "using: DavComptElec.PageFacture".

 <Grid>
        <Grid.DataContext>
            <local:ViewModel>
            </local:ViewModel>
        </Grid.DataContext>

but it is present in the cs page

Thanks for your help

Richard

Attachment: DavComptElec_83271fd8.7z

Rachel A [Syncfusion]
Replied On May 26, 2016 02:43 AM

Hi Pineau, 
 
Thanks for the update. 
 
We have checked your code and you need to define the ViewModel class outside of the MainPage Class. We have modified the  code and you can download from the following location. 
 
 
Regards, 
Rachel.A 


PINEAU
Replied On May 31, 2016 02:53 AM

Hello

Thank you for your reply.
I do not know why it does not work because of ViewModel and the Namespace.

I created a new project with just the necessary page and the problem recurs (cf screen and project in PJ ).

thank you in advance

Attachment: PBL_CompteurElectrique_ba7d1d61.rar

Rachel A [Syncfusion]
Replied On June 1, 2016 12:35 AM

Hi Pineau, 

Thanks for the update. 

We have modified the given sample and you can download the sample from the following location. 


You can view the output like the following screenshot. 

 

Regards, 
Rachel. A 


PINEAU
Replied On June 10, 2016 12:32 PM

Hello

Thank you for your reply.

Works perfectly

Regards, 
Richard

Rachel A [Syncfusion]
Replied On June 12, 2016 11:44 PM

Hi Pineau, 

Thanks for the update. 
  
Please let us know if you need any further assistance. 
  
Regards, 
Rachel. A 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;