Jump to content
Software FX Community

Binding XValuePath to IComparable throws exception (crucial problem)


Bober02

Recommended Posts

Dear All,

 I have a crucial problem with ChartFX component within my application. Basically, each of my points have property X, which is of type IComparable. I instantiate a few lines with X value being assigned a particular DateTime Object (I want my Xaxis to have dates on it) Now, I have the following piece of code:

var lt = new ListTransform();

lt.ColumnPath = "Points";

lt.ValuePath = "Y";

lt.SeriesPath = "Name";

 lt.XValuePath = "X";

which basically serves as a way to perform necessary ListTransform on my data. If I run this, with real object being a DateTime object, I get InvalidCasException : Cannot cast from DateTime to Double.

I believe this has to do with default XAxis format to be number or sth. like that. This is very important part of my application, so if you could provide any solution I would be extremely grateful.

Link to comment
Share on other sites

We choose how to convert values depending on the property type, if you change the type of property X to be DateTime then we will handle the dates properly, note that you will need to manually change the chart.AxisX.Labels.Format property to Date or DateTime.

Unfortunately if we do not recognize the type (e.g. if the property type is object or IComparable) we fall back to use Convert.ToDouble which throws the exception you mentioned.

JuanC

Link to comment
Share on other sites

Allow me to make a point here: Basically, you cannot have any DataSet with "general" data (where X is Object or IComparable) and then pass Dates, ints, strings etc, as you Converter will throw exception on most of them? I have a generic Data set for now, but I wanted to avoid it as it s causing difficulties later... Is there no workaround this?

Link to comment
Share on other sites

Although most of our tests were done with CLR classes that expose its properties with the "appropriate" type, i.e. int, string, date, double, I can see that handling properties of type object might be useful in some scenarios.

We should be able to provide a hotfix in the next few days to handle this.

JuanC

 

Link to comment
Share on other sites

We have added support for object properties in build 3880.

Unfortunately we do not have a way right now to provide stand-alone executables so I would suggest using our update site from a personal machine where you can control the browser and settings. After updating a separate machine it would just be a matter of copying all DLL files.

If you send a message to support we can provide a zip file but if future hotfixes are required it would be better if you could pick them up directly.

JuanC

Link to comment
Share on other sites

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...