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

Databinding List<Generics>

2 Answers 56 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jose David Escobar Ardila
Top achievements
Rank 1
Jose David Escobar Ardila asked on 10 Aug 2010, 05:06 PM
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 Answers, 1 is accepted

Sort by
0
Jose David Escobar Ardila
Top achievements
Rank 1
answered on 10 Aug 2010, 07:07 PM
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
0
Accepted
Giuseppe
Telerik team
answered on 12 Aug 2010, 08:45 AM
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
Tags
Chart (obsolete as of Q1 2013)
Asked by
Jose David Escobar Ardila
Top achievements
Rank 1
Answers by
Jose David Escobar Ardila
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or