Databinding List<Generics>

3 posts, 1 answers
  1. Jose David Escobar Ardila
    Jose David Escobar Ardila avatar
    3 posts
    Member since:
    Apr 2010

    Posted 10 Aug 2010 Link to this post

    SiteHello, I have a problem when I assign a generic list to the chart object,
    this is my class

    public class cs_itemspedido
        {
            private string referencia;
            private int cantidad;
            private string nombre;
            private double pesoxref;
            private double valor;
            private int osa;
     
            public int Osa
            {
                get { return osa; }
                set { osa = value; }
            }
            public double Valor
            {
                get { return valor; }
                set { valor = value; }
            }
            public double PesoXRef
            {
                get { return pesoxref; }
                set { pesoxref = value; }
            }
     
            public string Nombre
            {
                get { return nombre; }
                set { nombre = value; }
            }
     
            public string Referencia
            {
                get { return referencia; }
                set { referencia = value; }
            }
            public int Cantidad
            {
                get { return cantidad; }
                set { cantidad = value; }
            }
            /// <summary>
            /// Peso Total
            /// </summary>
            public double Peso_Total
            {
                get { return (cantidad * pesoxref); }
            }
            /// <summary>
            /// Valor total X item
            /// </summary>
            public double Valor_Total
            {
                get { return (cantidad * valor); }
            }
    }


    I just want to show the X axis the value of the property (Referencia) and the axle and (Peso_Total) value.

    I made this site what it says but I error out, series.count == 0

    thanks
  2. Jose David Escobar Ardila
    Jose David Escobar Ardila avatar
    3 posts
    Member since:
    Apr 2010

    Posted 10 Aug 2010 Link to this post

    Hi, I need to define the data type is the label example: string, or number that shows me everything I have as number and string data and instead are displaying it shows me 0
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 12 Aug 2010 Link to this post

    Hello Jose David Escobar Ardila,

    Attached is a runnable sample application that demonstrates the approach from the help topic.

    Note, that if you did not use VS Toolbox to drag&drop chart control to your project but you instantiated it manually, you will need to actually create the ChartSeries as well:

    //ChartSeries series = new ChartSeries();
    //radChart1.Series.Add(series);
    radChart1.Series[0].DataYColumn = "QuantityInStock";
    radChart1.PlotArea.XAxis.DataLabelsColumn = "Name";
    radChart1.DataSource = products;
    radChart1.DataBind();

    As for your second question -- we are a bit unsure what exactly are you looking for. Please elaborate a bit more if the problem still persists so we can advise you properly how to proceed.


    Kind regards,
    Freddie
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top