kenny70 Posted June 2, 2009 Report Share Posted June 2, 2009 How can I get the following to accept a string (or varchar from DB): chrtCompStrat.DataSourceSettings.Fields.Add(New FieldMap("X-Axis", FieldUsage.XValue)) When I use an int for "X-Axis", everything works fine but when I use a string I get the following:System.FormatException was unhandled by user code Message="Input string was not in a correct format." Source="mscorlib" StackTrace: at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) at System.Double.Parse(String s, NumberStyles style, NumberFormatInfo info) at System.Double.Parse(String s, IFormatProvider provider) at ChartFX.WebForms.DataSourceSettings.a(TypeCode A_0, Object A_1) at ChartFX.WebForms.DataSourceSettings.a(IDataEx A_0, FieldMapCollection A_1, PropertyDescriptorCollection A_2, b A_3, Boolean A_4) at ChartFX.WebForms.DataSourceSettings.a() at ChartFX.WebForms.DataSourceSettings.e() at ChartFX.WebForms.DataSourceSettings.set_DataSource(Object value) at compStratification.FillChart() in D:\webNET\rmeds\compStratification.aspx.vb:line 179 at compStratification.Page_Load(Object sender, EventArgs e) in D:\webNET\Stratification.aspx.vb:line 57 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) Quote Link to comment Share on other sites More sharing options...
juanZ Posted June 2, 2009 Report Share Posted June 2, 2009 When FieldUsage.XValue is used, data passed must be datetime or double value, that's why the "input string was not in a correct format" messages raise. So, you must manually assign Axis labels in order to use string types. vRow is a row from my DataTable object foreach (DataRow vRow in vTable.Rows) { Chart1.AxisX.Labels.Add(vRow["X-Axis].ToString()); } Quote Link to comment Share on other sites More sharing options...
TatianaG Posted June 2, 2009 Report Share Posted June 2, 2009 XValue instructs Chart FX to treat the selected field as a number to be used as the X axis coordinate. Quote Link to comment Share on other sites More sharing options...
nuwan Posted February 15, 2011 Report Share Posted February 15, 2011 Hi Junaz I tried this but it shows only the first lable. Can you please suggest a solution. Rgds Nuwan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.