giovedì 12 luglio 2012

RGraphWebApi instructions #1

First of all you should understand two things.
  • we need to automatize the way data ara loaded. Of course you can get your data from a db or any other repository but it was quite natural to me consider csv as the basic structure out of which data could be displayed. (the folder -repository- is App_Data\Series)
  • the structure is this:
    • we do have a header, that is not accounted while the data are loaded by the application
      X;Y;XLabel;YLabel;Notes
    • and rows of data according to the header
      12,00;;Jan;;notes for january
Now how do we go from this? It's quite simple:
we do have a class that has a property collection of DataPoint;
the property is called public List <DataPoint > SeriesPoints and can you guess what a DataPoint is?
Well, you can judge for yourself:
public class DataPoint
{
[Required]
public decimal X { get; set; }
public decimal? Y { get; set; }
[Required]
public string XLabel { get; set; }
public string YLabel { get; set; }
public string Notes { get; set; }
}

Elementary my dear Watson!!!

Nessun commento:

Posta un commento