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

[Solved] Multiple series in the model

0 Answers 33 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.
Fab
Top achievements
Rank 1
Fab asked on 11 Jan 2012, 12:27 AM
Hello,

in the demos you show how to display multiple series : the model has a propoerty for each serie
public class SalesData
{
  public string RepName { get; set; }
  public string DateString { get; set; }
  public decimal? TotalSales { get; set; }
  public decimal? RepSales { get; set; }
}

I want to bind a list of series and all that series should be displayed
ie with my Model :
public class ChartData<T>
{
   public string Title { get; set; }
   public List<ChartSerie<T>> Series { get; set; }
}
 
public class ChartSerie<T>
{
  public string Name { get; set; }
  public List<T> Values { get; set; }
  public String Format { get; set; }
}

so in my controller, I add multiple series
ChartData<float> chartData = new ChartData<float>();
ChartSerie<float> serieA = new ChartSerie<float>();
ChartSerie<float> serieB = new ChartSerie<float>();
ChartSerie<float> serieC = new ChartSerie<float>();
chartData.Series.Add(serieA);
chartData.Series.Add(serieB);
chartData.Series.Add(serieC);
//.... add values to series ...

is it possible to do that ? if so, how can i code the view ?
Thanks a lot
Tags
Chart
Asked by
Fab
Top achievements
Rank 1
Share this question
or