Rank: Advanced Member
Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered Joined: 1/3/2011(UTC) Posts: 483
Thanks: 0 times Was thanked: 87 time(s) in 87 post(s)
|
Hi, You can specify your model as you want. In this sample: www.jqchart.com/aspnetmvc/chart/ChartTypes/ColumnChartThis is the model: Code:using System; using System.Collections.Generic; using System.Linq; using System.Web;
namespace SamplesBrowser.Models { public class ChartData { public static List<ChartData> GetData() { var data = new List<ChartData>();
data.Add(new ChartData("A", 46, 78)); data.Add(new ChartData("B", 35, 72)); data.Add(new ChartData("C", 68, 86)); data.Add(new ChartData("D", 30, 23)); data.Add(new ChartData("E", 27, 70)); data.Add(new ChartData("F", 85, 60)); data.Add(new ChartData("D", 43, 88)); data.Add(new ChartData("H", 29, 22));
return data; }
public ChartData(string label, double value1) { this.Label = label; this.Value1 = value1; }
public ChartData(string label, double value1, double value2) { this.Label = label; this.Value1 = value1; this.Value2 = value2; }
public string Label { get; set; } public double Value1 { get; set; } public double Value2 { get; set; } } } and this is how we defining it on the page. @model IEnumerable<SamplesBrowser.Models.DateTimeXAxisChartData> Best Regards, Dragan Matek jqChart Inc.
|
1 user thanked Dragan for this useful post.
|
|