Hi there,
I thinking buying this product, because i need a stacked bar chart for Monotouch (for now...i will need more). But I can not see one good sample. Can you help me? I need something like that..simple: (thanks!!)
Hi,
thanks for you answer, now it's working!
You would not be able to change the theme values, as they are read only.
you can set the axis labelBrush property to a new IGBrush for that axis.
// sets the X-Axis labels to be red IGStackedBarSeries s = (IGStackedBarSeries)_chartView.Series [0]; s.XAxis.LabelBrush = new IGBrush (UIColor.Red);
As for custom labels,you would need to attach a delegate (and by extension create a delegate handler) to the IGChartView and process on the ResolveLabelForAxis method call in order to return your custom labels.
Updated the code file to show these changes.
Thanks for your help!
now i have this code and it's almost done!
3 more things:
-> i need to change the items name...is showing "item 0" and "item 1"
-> i would like to put the numeric data like "10k"
-> and how i change de font colour of the theme?
thanks for you help
public void ConstroiGraficoLoanAdvisor() { this.PopulateData(); _chartView = new IGChartView(); _chartView.Theme = IGChartGradientThemes.FinanceTheme2(); _chartView.Theme.LegendFont = UIFont.FromName("Helvetica Neue", 9); _chartView.Theme.Font = UIFont.FromName("Helvetica Neue", 9); _chartView.Frame = new RectangleF (5, 6, 240, 155); _chartView.BackgroundColor = UIColor.LightGray; _chartView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; _chartView.Delegate = new SampleChartDelegate(); List<NSString> valueList = new List<NSString> (); valueList.Add (new NSString("Interests")); valueList.Add (new NSString("Principal")); valueList.Add (new NSString("Costs")); _stackedChartDataSourceHelper = new IGStackedSeriesDataSourceHelper(_data.ToArray(),valueList.ToArray()); IGNumericXAxis xAxis = new IGNumericXAxis("xAxis"); xAxis.LabelOrientationAngle = -90; xAxis.Extent = 50; IGCategoryYAxis yAxis = new IGCategoryYAxis("yAxis"); yAxis.IsInverted = true; _chartView.AddAxis(xAxis); _chartView.AddAxis(yAxis); IGStackedBarSeries series = new IGStackedBarSeries ("series"); series.XAxis = xAxis; series.YAxis = yAxis; series.DataSource = _stackedChartDataSourceHelper; _chartView.AddStackedSeries(new Class(typeof(IGStackedBarSeries)), "series", _stackedChartDataSourceHelper, "xAxis", "yAxis"); (this.View).AddSubview(_chartView); _legend = new IGLegend(IGChartLegendType.IGChartLegendTypeSeries); _legend.Frame = new RectangleF(240, 10, 70, 60); _chartView.Legend = _legend; (this.View).AddSubview(_legend); } void PopulateData() { _data = new List<NSObject>(); DataModel item = new DataModel(); item.Interests = wOutputValorJurosLoanInput; item.Principal = wOutputValorAmortizacaoLoanInput; item.Costs = wOutputValorOutrosCustosLoanInput; item.Label = string.Format ("A"); _data.Add (item); item = new DataModel(); item.Interests = wOutputValorJurosLoanAdvisor; item.Principal = wOutputValorAmortizacaoLoanAdvisor; item.Costs = wOutputValorOutrosCustosLoanAdvisor; item.Label = "Advise"; _data.Add (item); } public class DataModel : NSObject { [Export("Label")] public string Label { get; set; } [Export("Interests")] public float Interests { get; set; } [Export("Principal")] public float Principal { get; set; } [Export("Costs")] public float Costs { get; set; } }
You would need to change the code in the sample to
List<NSString> valueList = new List<NSString> (); valueList.Add (new NSString("Value1")); valueList.Add (new NSString("Value2")); valueList.Add (new NSString("Value3")); _stackedChartDataSourceHelper = new IGStackedSeriesDataSourceHelper( _data.ToArray(), valueList.ToArray());
and add the following #usings
using Infragistics; using System.Collections.Generic; using MonoTouch.ObjCRuntime;
attached is the .cs class with the changes
The code in this help link: http://ko.infragistics.com/help/topic/53d75e81-b590-4294-aadb-2bb5d7afde46
give a error in this line:
stackedChartDataSourceHelper = new IGStackedSeriesDataSourceHelper(_data.ToArray(), NSArray.FromObjects("Value1", "Value2", "Value3"));
say can not convert objecto to array....
thanks