Jump to content
Software FX Community

Convert FieldUsage.XValue to String


kenny70

Recommended Posts

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)

 

 

Link to comment
Share on other sites

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());

 }

Link to comment
Share on other sites

  • 1 year later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...